Merge pull request #53 from haberman/filedef

Added upb::FileDef, which represents the file defs are declared in.
pull/13171/head
Joshua Haberman 9 years ago
commit 458077ccb4
  1. 4
      Makefile
  2. 5
      tests/pb/test_encoder.cc
  3. 15
      tests/test_cpp.cc
  4. 20
      tests/test_def.c
  5. 9
      tests/test_handlers.c
  6. 99
      tests/test_util.h
  7. 336
      tools/dump_cinit.lua
  8. 53
      tools/upbc.lua
  9. 174
      upb/bindings/lua/upb.c
  10. 259
      upb/def.c
  11. 218
      upb/def.h
  12. 938
      upb/descriptor/descriptor.upb.h
  13. 293
      upb/descriptor/descriptor.upbdefs.c
  14. 649
      upb/descriptor/descriptor.upbdefs.h
  15. 358
      upb/descriptor/reader.c
  16. 21
      upb/descriptor/reader.h
  17. 75
      upb/pb/glue.c
  18. 52
      upb/pb/glue.h
  19. 5
      upb/refcounted.c
  20. 17
      upb/structdefs.int.h
  21. 81
      upb/symtab.c
  22. 17
      upb/symtab.h
  23. 5
      upb/upb.h

@ -157,7 +157,7 @@ upb_SRCS = \
upb/upb.c \
upb_descriptor_SRCS = \
upb/descriptor/descriptor.upb.c \
upb/descriptor/descriptor.upbdefs.c \
upb/descriptor/reader.c \
upb_pb_SRCS = \
@ -254,7 +254,7 @@ upb/descriptor/descriptor.pb: upb/descriptor/descriptor.proto
protoc upb/descriptor/descriptor.proto -oupb/descriptor/descriptor.pb
genfiles: upb/descriptor/descriptor.pb tools/upbc
./tools/upbc upb/descriptor/descriptor.pb upb/descriptor/descriptor google_protobuf_descriptor
./tools/upbc upb/descriptor/descriptor.pb
$(LUA) third_party/dynasm/dynasm.lua -c upb/pb/compile_decoder_x64.dasc > upb/pb/compile_decoder_x64.h || (rm upb/pb/compile_decoder_x64.h ; false)
# upbc depends on these Lua extensions.

@ -1,7 +1,8 @@
#include "tests/test_util.h"
#include "tests/upb_test.h"
#include "upb/bindings/stdc++/string.h"
#include "upb/descriptor/descriptor.upb.h"
#include "upb/descriptor/descriptor.upbdefs.h"
#include "upb/pb/decoder.h"
#include "upb/pb/encoder.h"
#include "upb/pb/glue.h"
@ -18,7 +19,7 @@ std::string read_string(const char *filename) {
void test_pb_roundtrip() {
upb::reffed_ptr<const upb::MessageDef> md(
upbdefs::google::protobuf::FileDescriptorSet::MessageDef());
upbdefs::google::protobuf::FileDescriptorSet::get());
upb::reffed_ptr<const upb::Handlers> encoder_handlers(
upb::pb::Encoder::NewHandlers(md.get()));
upb::reffed_ptr<const upb::pb::DecoderMethod> method(

@ -6,6 +6,7 @@
#include <stdio.h>
#include <string.h>
#include <fstream>
#include <iostream>
#include <set>
#include <sstream>
@ -144,12 +145,22 @@ static void TestCastsConst10() {
}
static void TestSymbolTable(const char *descriptor_file) {
upb::reffed_ptr<upb::SymbolTable> s(upb::SymbolTable::New());
upb::Status status;
if (!upb::LoadDescriptorFileIntoSymtab(s.get(), descriptor_file, &status)) {
std::ifstream file_in(descriptor_file, std::ios::binary);
std::string descriptor((std::istreambuf_iterator<char>(file_in)),
(std::istreambuf_iterator<char>()));
std::vector<upb::reffed_ptr<upb::FileDef> > files;
if (!upb::LoadDescriptor(descriptor, &status, &files)) {
std::cerr << "Couldn't load descriptor: " << status.error_message();
exit(1);
}
upb::reffed_ptr<upb::SymbolTable> s(upb::SymbolTable::New());
for (size_t i = 0; i < files.size(); i++) {
ASSERT(s->AddFile(files[i].get(), &status));
}
ASSERT(!s->IsFrozen());
s->Freeze();
ASSERT(s->IsFrozen());

@ -3,6 +3,7 @@
** (like attempts to link defs that don't have required properties set).
*/
#include "tests/test_util.h"
#include "upb/def.h"
#include "upb/pb/glue.h"
#include "upb_test.h"
@ -41,12 +42,22 @@ static void test_noreftracking() {
static upb_symtab *load_test_proto(void *owner) {
upb_symtab *s = upb_symtab_new(owner);
upb_status status = UPB_STATUS_INIT;
size_t len;
char *data = upb_readfile(descriptor_file, &len);
upb_filedef **files;
ASSERT(s);
if (!upb_load_descriptor_file_into_symtab(s, descriptor_file, &status)) {
fprintf(stderr, "Error loading descriptor file: %s\n",
upb_status_errmsg(&status));
ASSERT(false);
ASSERT(data);
files = upb_loaddescriptor(data, len, &files, &status);
ASSERT(files);
free(data);
while (*files) {
bool ok = upb_symtab_addfile(s, *files, &status);
ASSERT(ok);
upb_filedef_unref(*files, &files);
files++;
}
ASSERT(!upb_symtab_isfrozen(s));
upb_symtab_freeze(s);
ASSERT(upb_symtab_isfrozen(s));
@ -391,6 +402,7 @@ static void test_mapentry_check() {
/* Should not have succeeded: non-repeated field pointing to a MapEntry. */
ASSERT(!upb_ok(&s));
upb_status_clear(&s);
upb_fielddef_setlabel(f, UPB_LABEL_REPEATED);
upb_symtab_add(symtab, defs, 2, NULL, &s);
ASSERT(upb_ok(&s));

@ -1,6 +1,6 @@
#include "upb/handlers.h"
#include "upb/descriptor/descriptor.upb.h"
#include "upb/descriptor/descriptor.upbdefs.h"
#include "upb_test.h"
#include <stdlib.h>
#include <string.h>
@ -13,10 +13,9 @@ static bool startmsg(void *c, const void *hd) {
static void test_error() {
/* Test creating handlers of a static msgdef. */
const upb_symtab *s = upbdefs_google_protobuf_descriptor(&s);
upb_handlers *h =
upb_handlers_new(upbdefs_google_protobuf_DescriptorProto(s), &h);
upb_symtab_unref(s, &s);
const upb_msgdef *m = upbdefs_google_protobuf_DescriptorProto_get(&m);
upb_handlers *h = upb_handlers_new(m, &h);
upb_msgdef_unref(m, &m);
/* Attempt to set the same handler twice causes error. */
ASSERT(upb_ok(upb_handlers_status(h)));

@ -11,23 +11,26 @@
#include "upb/env.h"
#include "upb/sink.h"
#ifdef __cplusplus
upb::BufferHandle global_handle;
// A convenience class for parser tests. Provides some useful features:
//
// - can support multiple calls to parse, to test the parser's handling
// of buffer seams.
//
// - can output verbose output about each parse call when requested, for
// ease of debugging.
//
// - can pass NULL for skipped regions of the input if requested.
//
// - allocates and passes a separate buffer for each parsed region, to
// ensure that the parser is not erroneously overreading its buffer.
/* A convenience class for parser tests. Provides some useful features:
*
* - can support multiple calls to parse, to test the parser's handling
* of buffer seams.
*
* - can output verbose output about each parse call when requested, for
* ease of debugging.
*
* - can pass NULL for skipped regions of the input if requested.
*
* - allocates and passes a separate buffer for each parsed region, to
* ensure that the parser is not erroneously overreading its buffer.
*/
class VerboseParserEnvironment {
public:
// Pass verbose=true to print detailed diagnostics to stderr.
/* Pass verbose=true to print detailed diagnostics to stderr. */
VerboseParserEnvironment(bool verbose) : verbose_(verbose) {
env_.SetErrorFunction(&VerboseParserEnvironment::OnError, this);
}
@ -60,15 +63,16 @@ class VerboseParserEnvironment {
skipped_with_null_ = false;
}
// The user should call a series of:
//
// Reset(buf, len, may_skip);
// Start()
// ParseBuffer(X);
// ParseBuffer(Y);
// // Repeat ParseBuffer as desired, but last call should pass -1.
// ParseBuffer(-1);
// End();
/* The user should call a series of:
*
* Reset(buf, len, may_skip);
* Start()
* ParseBuffer(X);
* ParseBuffer(Y);
* // Repeat ParseBuffer as desired, but last call should pass -1.
* ParseBuffer(-1);
* End();
*/
bool Start() {
@ -111,9 +115,9 @@ class VerboseParserEnvironment {
ASSERT((size_t)bytes <= (len_ - ofs_));
// Copy buffer into a separate, temporary buffer.
// This is necessary to verify that the parser is not erroneously
// reading outside the specified bounds.
/* Copy buffer into a separate, temporary buffer.
* This is necessary to verify that the parser is not erroneously
* reading outside the specified bounds. */
char *buf2 = NULL;
if ((int)(ofs_ + bytes) <= skip_until_) {
@ -125,7 +129,7 @@ class VerboseParserEnvironment {
}
if (buf2 == NULL && bytes == 0) {
// Decoders dont' support buf=NULL, bytes=0.
/* Decoders dont' support buf=NULL, bytes=0. */
return true;
}
@ -189,18 +193,41 @@ class VerboseParserEnvironment {
bool end_ok_;
bool end_ok_set_;
// When our parse call returns a value greater than the number of bytes
// we passed in, the decoder is indicating to us that the next N bytes
// in the stream are not needed and can be skipped. The user is allowed
// to pass a NULL buffer for those N bytes.
//
// skip_until_ is initially set to 0 if we should do this NULL-buffer
// skipping or -1 if we should not. If we are open to doing NULL-buffer
// skipping and we get an opportunity to do it, we set skip_until to the
// stream offset where we can skip until. The user can then test whether
// this happened by testing SkippedWithNull().
/* When our parse call returns a value greater than the number of bytes
* we passed in, the decoder is indicating to us that the next N bytes
* in the stream are not needed and can be skipped. The user is allowed
* to pass a NULL buffer for those N bytes.
*
* skip_until_ is initially set to 0 if we should do this NULL-buffer
* skipping or -1 if we should not. If we are open to doing NULL-buffer
* skipping and we get an opportunity to do it, we set skip_until to the
* stream offset where we can skip until. The user can then test whether
* this happened by testing SkippedWithNull(). */
int skip_until_;
bool skipped_with_null_;
};
#endif /* __cplusplus */
UPB_INLINE char *upb_readfile(const char *filename, size_t *len) {
long size;
char *buf;
FILE *f = fopen(filename, "rb");
if(!f) return NULL;
if(fseek(f, 0, SEEK_END) != 0) goto error;
size = ftell(f);
if(size < 0) goto error;
if(fseek(f, 0, SEEK_SET) != 0) goto error;
buf = (char*)malloc(size + 1);
if(size && fread(buf, size, 1, f) != 1) goto error;
fclose(f);
if (len) *len = size;
buf[size] = '\0';
return buf;
error:
fclose(f);
return NULL;
}
#endif

@ -88,7 +88,9 @@ function sorted_defs(defs)
local sorted = {}
for def in defs do
sorted[#sorted + 1] = def
if def.type == deftype then
sorted[#sorted + 1] = def
end
end
table.sort(sorted,
@ -318,7 +320,7 @@ end
-- Strips away last path element, ie:
-- foo.Bar.Baz -> foo.Bar
local function getpackage(name)
local function remove_name(name)
local package_end = 0
for i=1,string.len(name) do
if string.byte(name, i) == string.byte(".", 1) then
@ -328,19 +330,6 @@ local function getpackage(name)
return string.sub(name, 1, package_end)
end
-- Returns only the last path element, ie:
-- foo.Bar.Baz -> Baz
local function relname(name)
local package = getpackage(name)
return string.sub(name, string.len(package) + 2)
end
local function strip_prefix(prefix, str)
assert(string.sub(str, 1, string.len(prefix)) == prefix)
return string.sub(str, string.len(prefix) + 1)
end
local function start_namespace(package, append)
local package_components = split(package)
for _, component in ipairs(package_components) do
@ -361,9 +350,9 @@ end
--]]
local function dump_defs_c(symtab, basename, namespace, append)
local function dump_defs_c(filedef, append)
local defs = {}
for def in symtab:defs(upb.DEF_ANY) do
for def in filedef:defs(upb.DEF_ANY) do
defs[#defs + 1] = def
if (def:def_type() == upb.DEF_MSG) then
for field in def:fields() do
@ -412,17 +401,11 @@ local function dump_defs_c(symtab, basename, namespace, append)
end
end
-- Symbol table entries.
reftable_count = reftable_count + 2
for _, e in ipairs(upbtable.symtab_symtab(symtab).entries) do
linktab:add("strentries", e.ptr, e)
end
-- Emit forward declarations.
emit_file_warning(append)
append('#include <assert.h>\n\n')
append('#include "upb/def.h"\n')
append('#include "upb/structdefs.int.h"\n')
append('#include "upb/symtab.h"\n\n')
append('#include "upb/structdefs.int.h"\n\n')
append("static const upb_msgdef %s;\n", linktab:cdecl(upb.DEF_MSG))
append("static const upb_fielddef %s;\n", linktab:cdecl(upb.DEF_FIELD))
if not linktab:empty(upb.DEF_ENUM) then
@ -531,19 +514,6 @@ local function dump_defs_c(symtab, basename, namespace, append)
end
append("};\n\n");
append("static const upb_symtab symtab = " ..
"UPB_SYMTAB_INIT(%s, &reftables[%d], &reftables[%d]);\n\n",
dumper:strtable(upbtable.symtab_symtab(symtab)),
reftable,
reftable + 1);
-- TODO: don't hardcode this.
append("const upb_symtab *%s_%s(const void *owner) " ..
"{\n", namespace, to_cident(basename))
append(" upb_symtab_ref(&symtab, owner);\n")
append(" return &symtab;\n")
append("}\n\n")
append("#ifdef UPB_DEBUG_REFS\n")
append("static upb_inttable reftables[%d] = {\n", reftable_count)
for i = 1,reftable_count do
@ -552,18 +522,62 @@ local function dump_defs_c(symtab, basename, namespace, append)
append("};\n")
append("#endif\n\n")
append("static const upb_msgdef *refm(const upb_msgdef *m, const void *owner) {\n")
append(" upb_msgdef_ref(m, owner);\n")
append(" return m;\n")
append("}\n\n")
append("static const upb_enumdef *refe(const upb_enumdef *e, const void *owner) {\n")
append(" upb_enumdef_ref(e, owner);\n")
append(" return e;\n")
append("}\n\n")
append("/* Public API. */\n")
for m in linktab:objs(upb.DEF_MSG) do
append("const upb_msgdef *upbdefs_%s_get(const void *owner)" ..
" { return refm(%s, owner); }\n",
to_cident(m:full_name()), linktab:addr(m))
end
append("\n")
for e in linktab:objs(upb.DEF_ENUM) do
append("const upb_enumdef *upbdefs_%s_get(const void *owner)" ..
" { return refe(%s, owner); }\n",
to_cident(e:full_name()), linktab:addr(e))
end
return linktab
end
local function dump_defs_for_type(format, defs, namespace, append)
local function dump_defs_for_type(format, defs, append)
local sorted = sorted_defs(defs)
for _, def in ipairs(sorted) do
append(format, namespace, to_cident(def:full_name()), def:full_name())
append(format, to_cident(def:full_name()), def:full_name())
end
append("\n")
end
local function make_children_map(file)
-- Maps file:package() or msg:full_name() -> children.
local map = {}
for def in file:defs(upb.DEF_ANY) do
local container = remove_name(def:full_name())
if not map[container] then
map[container] = {}
end
table.insert(map[container], def)
end
-- Sort all the lists for a consistent ordering.
for name, children in pairs(map) do
table.sort(children, function(a, b) return a:name() < b:name() end)
end
return map
end
local function dump_enum_vals(enumdef, append)
local enum_vals = {}
@ -597,10 +611,10 @@ local function dump_enum_vals(enumdef, append)
-- GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_DOUBLE = 1
--
-- (notice the duplicated "TYPE").
local cident = to_cident(getpackage(enumdef:full_name()))
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', to_preproc(cident, k), v)
append(' %s = %d', cident .. "_" .. k, v)
if i == #enum_vals then
append('\n')
else
@ -609,53 +623,63 @@ local function dump_enum_vals(enumdef, append)
end
end
local function dump_selectors(msgdef, append, base)
local selectors = {}
local types = handler_types(base)
for f in msgdef:fields() do
for _, handler_type in ipairs(types) do
local sel = f:getsel(base[handler_type])
if sel then
selectors[#selectors + 1] = {
f:name() .. "_" .. strip_prefix("HANDLER_", handler_type),
sel
}
end
end
end
local print_classes
table.sort(selectors, function(a, b) return a[2] < b[2] end)
local function print_message(def, map, indent, append)
append("\n")
append("%sclass %s : public upb::reffed_ptr<const upb::MessageDef> {\n",
indent, def:name())
append("%s public:\n", indent)
append("%s %s(const upb::MessageDef* m, const void *ref_donor = NULL)\n",
indent, def:name())
append("%s : reffed_ptr(m, ref_donor) {\n", indent)
append("%s assert(upbdefs_%s_is(m));\n", indent, to_cident(def:full_name()))
append("%s }\n", indent)
append("\n")
append("%s static %s get() {\n", indent, def:name())
append("%s const upb::MessageDef* m = upbdefs_%s_get(&m);\n", indent, to_cident(def:full_name()))
append("%s return %s(m, &m);\n", indent, def:name())
append("%s }\n", indent)
-- TODO(haberman): add fields
print_classes(def:full_name(), map, indent .. " ", append)
append("%s};\n", indent)
end
-- This is kind of gross, but unless we add something to selectors to
-- distinguish them from enum values, we get conflicts like this:
--
-- // This can be either the enum value:
-- package google.protobuf;
-- message FieldDescriptorProto {
-- enum Type {
-- TYPE_INT32 = X;
-- }
-- optional Type type = 1;
-- }
--
-- // Now this can be either the enum value or the selector for the
-- // int32 handler for the "type" field.
-- GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_INT32
--
-- // So instead we make the latter the very beautiful:
-- SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_INT32
append("/* %s */\n", msgdef:full_name())
local cident = to_cident(msgdef:full_name())
for _, pair in ipairs(selectors) do
k, v = pair[1], pair[2]
append('#define SEL_%s %d\n', to_preproc(cident, k), v)
end
local function print_enum(def, indent, append)
append("\n")
append("%sclass %s : public upb::reffed_ptr<const upb::EnumDef> {\n",
indent, def:name())
append("%s public:\n", indent)
append("%s %s(const upb::EnumDef* e, const void *ref_donor = NULL)\n",
indent, def:name())
append("%s : reffed_ptr(e, ref_donor) {\n", indent)
append("%s assert(upbdefs_%s_is(e));\n", indent, to_cident(def:full_name()))
append("%s }\n", indent)
append("%s static %s get() {\n", indent, def:name())
append("%s const upb::EnumDef* e = upbdefs_%s_get(&e);\n", indent, to_cident(def:full_name()))
append("%s return %s(e, &e);\n", indent, def:name())
append("%s }\n", indent)
append("%s};\n", indent)
end
function print_classes(name, map, indent, append)
if not map[name] then
return
end
for _, def in ipairs(map[name]) do
if def:def_type() == upb.DEF_MSG then
print_message(def, map, indent, append)
elseif def:def_type() == upb.DEF_ENUM then
print_enum(def, indent, append)
else
error("Unknown def type for " .. def:full_name())
end
end
end
local function dump_defs_h(symtab, basename, namespace, append, linktab)
local basename_preproc = to_preproc(basename)
local function dump_defs_h(file, append, linktab)
local basename_preproc = to_preproc(file:name())
append("/* This file contains accessors for a set of compiled-in defs.\n")
append(" * Note that unlike Google's protobuf, it does *not* define\n")
append(" * generated classes or any other kind of data structure for\n")
@ -665,61 +689,42 @@ local function dump_defs_h(symtab, basename, namespace, append, linktab)
emit_file_warning(append)
append('#ifndef %s_UPB_H_\n', basename_preproc)
append('#define %s_UPB_H_\n\n', basename_preproc)
append('#include "upb/def.h"\n')
append('#include "upb/symtab.h"\n\n')
append('#ifdef __cplusplus\n')
append('UPB_BEGIN_EXTERN_C\n')
append('#endif\n\n')
local packages = {}
for def in symtab:defs(upb.DEF_ANY) do
if def:def_type() == upb.DEF_MSG then
packages[def:full_name()] = true
else
packages[getpackage(def:full_name())] = true
end
end
append('#include "upb/def.h"\n\n')
append('UPB_BEGIN_EXTERN_C\n\n')
-- Dump C enums for proto enums.
append("/* Enums */\n\n")
for _, def in ipairs(sorted_defs(symtab:defs(upb.DEF_ENUM))) do
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
-- selectors
append("/* Selectors */\n\n")
for _, def in ipairs(sorted_defs(symtab:defs(upb.DEF_MSG))) do
dump_selectors(def, append, upb)
end
append("const upb_symtab *%s_%s(const void *owner);" ..
"\n\n", namespace, to_cident(basename))
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",
file:defs(upb.DEF_MSG), append)
append("/* MessageDefs */\n")
append("/* EnumDefs: call these functions to get a ref to an enumdef. */\n")
dump_defs_for_type(
"UPB_INLINE const upb_msgdef *%s_%s(const upb_symtab *s) {\n" ..
" const upb_msgdef *m = upb_symtab_lookupmsg(s, \"%s\");\n" ..
" assert(m);\n" ..
" return m;\n" ..
"}\n",
symtab:defs(upb.DEF_MSG),
namespace, append)
"const upb_enumdef *upbdefs_%s_get(const void *owner);\n",
file:defs(upb.DEF_ENUM), append)
append("\n")
append("/* Functions to test whether this message is of a certain type. */\n")
dump_defs_for_type(
"UPB_INLINE bool upbdefs_%s_is(const upb_msgdef *m) {\n" ..
" return strcmp(upb_msgdef_fullname(m), \"%s\") == 0;\n}\n",
file:defs(upb.DEF_MSG), append)
append("/* EnumDefs */\n")
append("/* Functions to test whether this enum is of a certain type. */\n")
dump_defs_for_type(
"UPB_INLINE const upb_enumdef *%s_%s(const upb_symtab *s) {\n" ..
" const upb_enumdef *e = upb_symtab_lookupenum(s, \"%s\");\n" ..
" assert(e);\n" ..
" return e;\n" ..
"}\n",
symtab:defs(upb.DEF_ENUM),
namespace, append)
"UPB_INLINE bool upbdefs_%s_is(const upb_enumdef *e) {\n" ..
" return strcmp(upb_enumdef_fullname(e), \"%s\") == 0;\n}\n",
file:defs(upb.DEF_ENUM), append)
append("\n")
-- fields
local fields = {}
@ -731,79 +736,38 @@ local function dump_defs_h(symtab, basename, namespace, append, linktab)
table.sort(fields, function(a, b) return a[1] < b[1] end)
append("/* Functions to get a fielddef from a msgdef reference. */\n")
for _, field in ipairs(fields) do
local f = field[2]
append("UPB_INLINE const upb_fielddef *%s_%s(const upb_symtab *s) {" ..
" return upb_msgdef_itof(%s_%s(s), %d); }\n",
namespace, field[1], namespace,
to_cident(f:containing_type():full_name()), f:number())
local msg_cident = to_cident(f:containing_type():full_name())
local field_cident = to_cident(f:name())
append("UPB_INLINE const upb_fielddef *upbdefs_%s_f_%s(const upb_msgdef *m) {" ..
" assert(upbdefs_%s_is(m));" ..
" return upb_msgdef_itof(m, %d); }\n",
msg_cident, field_cident, msg_cident, f:number())
end
append("\n")
append('UPB_END_EXTERN_C\n\n')
append("#ifdef __cplusplus\n\n")
append('\nUPB_END_EXTERN_C\n\n')
append("namespace %s {\n", namespace)
-- C++ wrappers.
local children_map = make_children_map(file)
start_namespace(basename, append)
append("inline upb::reffed_ptr<const upb::SymbolTable> SymbolTable() {\n")
append(" const upb::SymbolTable* s = %s_google_protobuf_descriptor(&s);\n",
namespace)
append(" return upb::reffed_ptr<const upb::SymbolTable>(s, &s);\n")
append("}\n")
end_namespace(basename, append)
append("#ifdef __cplusplus\n\n")
append("namespace upbdefs {\n")
start_namespace(file:package(), append)
print_classes(file:package(), children_map, "", append)
append("\n")
end_namespace(file:package(), append)
append("} /* namespace upbdefs */\n\n")
append("#endif /* __cplusplus */\n")
append([[#define RETURN_REFFED(type, func) \
const type* obj = func(%s::google::protobuf::descriptor::SymbolTable().get()); \
return upb::reffed_ptr<const type>(obj);
]], namespace)
for _, package in ipairs(sortedkeys(packages)) do
start_namespace(package, append)
local def = symtab:lookup(package)
if def then
assert(def:def_type() == upb.DEF_MSG)
append("inline upb::reffed_ptr<const upb::MessageDef> MessageDef() " ..
"{ RETURN_REFFED(upb::MessageDef, %s_%s) }\n",
namespace, to_cident(def:full_name()))
end
for f in linktab:objs(upb.DEF_FIELD) do
if f:containing_type():full_name() == package then
append("inline upb::reffed_ptr<const upb::FieldDef> %s() " ..
"{ RETURN_REFFED(upb::FieldDef, %s_%s_%s) }\n",
f:name(), namespace, to_cident(f:containing_type():full_name()),
f:name())
end
end
for e in linktab:objs(upb.DEF_ENUM) do
if getpackage(e:full_name()) == package then
append("inline upb::reffed_ptr<const upb::EnumDef> %s() " ..
"{ RETURN_REFFED(upb::EnumDef, %s_%s) }\n",
relname(e:full_name()), namespace, to_cident(e:full_name()))
end
end
end_namespace(package, append)
append("\n")
end
append("} /* namespace %s */\n\n\n", namespace)
append("#undef RETURN_REFFED\n")
append("#endif /* __cplusplus */\n\n")
append("\n")
append('#endif /* %s_UPB_H_ */\n', basename_preproc)
end
function export.dump_defs(symtab, basename, append_h, append_c)
local linktab = dump_defs_c(symtab, basename, "upbdefs", append_c)
dump_defs_h(symtab, basename, "upbdefs", append_h, linktab)
function export.dump_defs(filedef, append_h, append_c)
local linktab = dump_defs_c(filedef, append_c)
dump_defs_h(filedef, append_h, linktab)
end
return export

@ -12,40 +12,47 @@ local dump_cinit = require "dump_cinit"
local upb = require "upb"
local src = arg[1]
local outbase = arg[2]
local basename = arg[3]
if not (src and outbase and basename) then
print("Usage: upbc <binary descriptor> <output filename base> <symbol prefix>")
if not src then
print("Usage: upbc <binary descriptor>")
return 1
end
local hfilename = outbase .. ".upb.h"
local 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))
function strip_proto(filename)
return string.gsub(filename, '%.proto$','')
end
-- Open input/output files.
local f = assert(io.open(src, "r"), "couldn't open input file " .. src)
local descriptor = f:read("*all")
local files = upb.load_descriptor(descriptor)
local symtab = upb.SymbolTable()
symtab:load_descriptor(descriptor)
os.execute(string.format("mkdir -p `dirname %s`", outbase))
local hfile = assert(io.open(hfilename, "w"), "couldn't open " .. hfilename)
local cfile = assert(io.open(cfilename, "w"), "couldn't open " .. cfilename)
for _, file in ipairs(files) do
symtab:add_file(file)
local outbase = strip_proto(file:name())
local hfilename = outbase .. ".upbdefs.h"
local cfilename = outbase .. ".upbdefs.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 happend = dump_cinit.file_appender(hfile)
local cappend = dump_cinit.file_appender(cfile)
os.execute(string.format("mkdir -p `dirname %s`", outbase))
local hfile = assert(io.open(hfilename, "w"), "couldn't open " .. hfilename)
local cfile = assert(io.open(cfilename, "w"), "couldn't open " .. cfilename)
-- Dump defs
dump_cinit.dump_defs(symtab, basename, happend, cappend)
local happend = dump_cinit.file_appender(hfile)
local cappend = dump_cinit.file_appender(cfile)
hfile:close()
cfile:close()
-- Dump defs
dump_cinit.dump_defs(file, happend, cappend)
hfile:close()
cfile:close()
end

@ -36,6 +36,7 @@
#define LUPB_MSGDEF "lupb.msgdef"
#define LUPB_ENUMDEF "lupb.enumdef"
#define LUPB_FIELDDEF "lupb.fielddef"
#define LUPB_FILEDEF "lupb.filedef"
#define LUPB_SYMTAB "lupb.symtab"
/* Other table constants. */
@ -485,6 +486,12 @@ static int lupb_def_fullname(lua_State *L) {
return 1;
}
static int lupb_def_name(lua_State *L) {
const upb_def *def = lupb_def_check(L, 1);
lua_pushstring(L, upb_def_name(def));
return 1;
}
static int lupb_def_setfullname(lua_State *L) {
const char *name = lupb_checkname(L, 2);
CHK(upb_def_setfullname(lupb_def_checkmutable(L, 1), name, &status));
@ -496,6 +503,7 @@ static int lupb_def_setfullname(lua_State *L) {
{"full_name", lupb_def_fullname}, \
{"freeze", lupb_def_freeze}, \
{"is_frozen", lupb_def_isfrozen}, \
{"name", lupb_def_name}, \
{"set_full_name", lupb_def_setfullname}, \
@ -1056,6 +1064,128 @@ static const struct luaL_Reg lupb_enumdef_m[] = {
};
/* lupb_filedef ***************************************************************/
void lupb_filedef_pushwrapper(lua_State *L, const upb_filedef *f,
const void *ref_donor) {
lupb_refcounted_pushwrapper(L, upb_filedef_upcast(f), LUPB_FILEDEF, ref_donor,
sizeof(void *));
}
void lupb_filedef_pushnewrapper(lua_State *L, const upb_filedef *f,
const void *ref_donor) {
lupb_refcounted_pushnewrapper(L, upb_filedef_upcast(f), LUPB_FILEDEF,
ref_donor);
}
const upb_filedef *lupb_filedef_check(lua_State *L, int narg) {
return lupb_refcounted_check(L, narg, LUPB_FILEDEF);
}
static upb_filedef *lupb_filedef_checkmutable(lua_State *L, int narg) {
const upb_filedef *f = lupb_filedef_check(L, narg);
if (upb_filedef_isfrozen(f))
luaL_error(L, "not allowed on frozen value");
return (upb_filedef*)f;
}
static int lupb_filedef_new(lua_State *L) {
upb_filedef *f = upb_filedef_new(&f);
lupb_filedef_pushnewrapper(L, f, &f);
return 1;
}
static int lupb_filedef_def(lua_State *L) {
const upb_filedef *f = lupb_filedef_check(L, 1);
int index = luaL_checkint(L, 2);
const upb_def *def = upb_filedef_def(f, index);
if (!def) {
return luaL_error(L, "index out of range");
}
lupb_def_pushwrapper(L, def, NULL);
return 1;
}
static int lupb_filedef_name(lua_State *L) {
const upb_filedef *f = lupb_filedef_check(L, 1);
lua_pushstring(L, upb_filedef_name(f));
return 1;
}
static int lupb_filedef_package(lua_State *L) {
const upb_filedef *f = lupb_filedef_check(L, 1);
lua_pushstring(L, upb_filedef_package(f));
return 1;
}
static int lupb_filedef_len(lua_State *L) {
const upb_filedef *f = lupb_filedef_check(L, 1);
lua_pushinteger(L, upb_filedef_defcount(f));
return 1;
}
static int lupb_filedef_setname(lua_State *L) {
upb_filedef *f = lupb_filedef_checkmutable(L, 1);
CHK(upb_filedef_setname(f, lupb_checkname(L, 2), &status));
return 0;
}
static int lupb_filedef_setpackage(lua_State *L) {
upb_filedef *f = lupb_filedef_checkmutable(L, 1);
CHK(upb_filedef_setpackage(f, lupb_checkname(L, 2), &status));
return 0;
}
static int lupb_filedefiter_next(lua_State *L) {
const upb_filedef *f = lupb_filedef_check(L, lua_upvalueindex(1));
int type = lua_tointeger(L, lua_upvalueindex(2));
size_t i = lua_tointeger(L, lua_upvalueindex(3));
size_t n = upb_filedef_defcount(f);
for (; i < n; i++) {
const upb_def *def;
def = upb_filedef_def(f, i);
assert(def);
if (type == UPB_DEF_ANY || upb_def_type(def) == type) {
lua_pushinteger(L, i + 1);
lua_replace(L, lua_upvalueindex(3));
lupb_def_pushwrapper(L, def, NULL);
return 1;
}
}
return 0;
}
static int lupb_filedef_defs(lua_State *L) {
lupb_filedef_check(L, 1);
luaL_checkinteger(L, 2); /* Def type. Could make this optional. */
lua_pushnumber(L, 0); /* Index, starts at zero. */
lua_pushcclosure(L, &lupb_filedefiter_next, 3);
return 1;
}
static const struct luaL_Reg lupb_filedef_mm[] = {
{"__len", lupb_filedef_len},
{NULL, NULL}
};
static const struct luaL_Reg lupb_filedef_m[] = {
{"def", lupb_filedef_def},
{"defs", lupb_filedef_defs},
{"name", lupb_filedef_name},
{"package", lupb_filedef_package},
{"set_name", lupb_filedef_setname},
{"set_package", lupb_filedef_setpackage},
{NULL, NULL}
};
/* lupb_symtab ****************************************************************/
/* Inherits a ref on the symtab.
@ -1128,6 +1258,13 @@ static int lupb_symtab_add(lua_State *L) {
return 0;
}
static int lupb_symtab_addfile(lua_State *L) {
upb_symtab *s = lupb_symtab_checkmutable(L, 1);
upb_filedef *f = lupb_filedef_checkmutable(L, 2);
CHK(upb_symtab_addfile(s, f, &status));
return 0;
}
static int lupb_symtab_lookup(lua_State *L) {
const upb_symtab *s = lupb_symtab_check(L, 1);
int i;
@ -1158,24 +1295,13 @@ static int lupb_symtab_defs(lua_State *L) {
return 1;
}
/* This is a *temporary* API that will be removed once pending refactorings are
* complete (it does not belong here in core because it depends on both
* the descriptor.proto schema and the protobuf binary format. */
static int lupb_symtab_load_descriptor(lua_State *L) {
size_t len;
upb_symtab *s = lupb_symtab_checkmutable(L, 1);
const char *str = luaL_checklstring(L, 2, &len);
CHK(upb_load_descriptor_into_symtab(s, str, len, &status));
return 0;
}
static const struct luaL_Reg lupb_symtab_m[] = {
{"add", lupb_symtab_add},
{"add_file", lupb_symtab_addfile},
{"defs", lupb_symtab_defs},
{"freeze", lupb_symtab_freeze},
{"is_frozen", lupb_symtab_isfrozen},
{"lookup", lupb_symtab_lookup},
{"load_descriptor", lupb_symtab_load_descriptor},
{NULL, NULL}
};
@ -1287,7 +1413,7 @@ static const struct luaL_Reg lupb_array_mm[] = {
/* lupb_msg **************************************************************/
/* A lupb_msg is a userdata where:
*
*
* - the userdata's memory contains hasbits and primitive fields.
* - the userdata's environment table / uservalue contains references to string
* fields, submessage fields, and array fields. */
@ -1734,14 +1860,35 @@ static int lupb_freeze(lua_State *L) {
return 0;
}
/* This is a *temporary* API that will be removed once pending refactorings are
* complete (it does not belong here in core because it depends on both
* the descriptor.proto schema and the protobuf binary format. */
static int lupb_loaddescriptor(lua_State *L) {
size_t len;
const char *str = luaL_checklstring(L, 1, &len);
size_t i;
upb_filedef **files = NULL;
CHK(files = upb_loaddescriptor(str, len, &files, &status));
lua_newtable(L);
for (i = 1; *files; i++, files++) {
lupb_filedef_pushnewrapper(L, *files, &files);
lua_rawseti(L, -2, i);
}
return 1;
}
static const struct luaL_Reg lupb_toplevel_m[] = {
{"Array", lupb_array_new},
{"EnumDef", lupb_enumdef_new},
{"FieldDef", lupb_fielddef_new},
{"FileDef", lupb_filedef_new},
{"Message", lupb_msg_new},
{"MessageDef", lupb_msgdef_new},
{"SymbolTable", lupb_symtab_new},
{"freeze", lupb_freeze},
{"load_descriptor", lupb_loaddescriptor},
{NULL, NULL}
};
@ -1791,6 +1938,7 @@ int luaopen_upb_c(lua_State *L) {
/* Refcounted types. */
lupb_register_type(L, LUPB_ENUMDEF, lupb_enumdef_m, lupb_enumdef_mm, true);
lupb_register_type(L, LUPB_FIELDDEF, lupb_fielddef_m, NULL, true);
lupb_register_type(L, LUPB_FILEDEF, lupb_filedef_m, lupb_filedef_mm, true);
lupb_register_type(L, LUPB_SYMTAB, lupb_symtab_m, NULL, true);
/* Refcounted but with custom __gc. */

@ -73,6 +73,20 @@ upb_deftype_t upb_def_type(const upb_def *d) { return d->type; }
const char *upb_def_fullname(const upb_def *d) { return d->fullname; }
const char *upb_def_name(const upb_def *d) {
const char *p;
if (d->fullname == NULL) {
return NULL;
} else if ((p = strrchr(d->fullname, '.')) == NULL) {
/* No '.' in the name, return the full string. */
return d->fullname;
} else {
/* Return one past the last '.'. */
return p + 1;
}
}
bool upb_def_setfullname(upb_def *def, const char *fullname, upb_status *s) {
assert(!upb_def_isfrozen(def));
if (!upb_isident(fullname, strlen(fullname), true, s)) return false;
@ -81,6 +95,8 @@ bool upb_def_setfullname(upb_def *def, const char *fullname, upb_status *s) {
return true;
}
const upb_filedef *upb_def_file(const upb_def *d) { return d->file; }
upb_def *upb_def_dup(const upb_def *def, const void *o) {
switch (def->type) {
case UPB_DEF_MSG:
@ -103,6 +119,7 @@ static bool upb_def_init(upb_def *def, upb_deftype_t type,
def->type = type;
def->fullname = NULL;
def->came_from_user = false;
def->file = NULL;
return true;
}
@ -318,11 +335,8 @@ static bool assign_msg_indices(upb_msgdef *m, upb_status *s) {
return true;
}
bool upb_def_freeze(upb_def *const* defs, int n, upb_status *s) {
int i;
int maxdepth;
bool ret;
upb_status_clear(s);
bool _upb_def_validate(upb_def *const*defs, size_t n, upb_status *s) {
size_t i;
/* First perform validation, in two passes so we can check that we have a
* transitive closure without needing to search. */
@ -348,8 +362,9 @@ bool upb_def_freeze(upb_def *const* defs, int n, upb_status *s) {
/* Second pass of validation. Also assign selector bases and indexes, and
* compact tables. */
for (i = 0; i < n; i++) {
upb_msgdef *m = upb_dyncast_msgdef_mutable(defs[i]);
upb_enumdef *e = upb_dyncast_enumdef_mutable(defs[i]);
upb_def *def = defs[i];
upb_msgdef *m = upb_dyncast_msgdef_mutable(def);
upb_enumdef *e = upb_dyncast_enumdef_mutable(def);
if (m) {
upb_inttable_compact(&m->itof);
if (!assign_msg_indices(m, s)) {
@ -360,23 +375,31 @@ bool upb_def_freeze(upb_def *const* defs, int n, upb_status *s) {
}
}
/* Def graph contains FieldDefs between each MessageDef, so double the
* limit. */
maxdepth = UPB_MAX_MESSAGE_DEPTH * 2;
/* Validation all passed; freeze the defs. */
ret = upb_refcounted_freeze((upb_refcounted * const *)defs, n, s, maxdepth);
assert(!(s && ret != upb_ok(s)));
return ret;
return true;
err:
for (i = 0; i < n; i++) {
defs[i]->came_from_user = false;
upb_def *def = defs[i];
def->came_from_user = false;
}
assert(!(s && upb_ok(s)));
return false;
}
bool upb_def_freeze(upb_def *const* defs, size_t n, upb_status *s) {
/* Def graph contains FieldDefs between each MessageDef, so double the
* limit. */
const size_t maxdepth = UPB_MAX_MESSAGE_DEPTH * 2;
if (!_upb_def_validate(defs, n, s)) {
return false;
}
/* Validation all passed; freeze the objects. */
return upb_refcounted_freeze((upb_refcounted *const*)defs, n, s, maxdepth);
}
/* upb_enumdef ****************************************************************/
@ -435,6 +458,10 @@ const char *upb_enumdef_fullname(const upb_enumdef *e) {
return upb_def_fullname(upb_enumdef_upcast(e));
}
const char *upb_enumdef_name(const upb_enumdef *e) {
return upb_def_name(upb_enumdef_upcast(e));
}
bool upb_enumdef_setfullname(upb_enumdef *e, const char *fullname,
upb_status *s) {
return upb_def_setfullname(upb_enumdef_upcast_mutable(e), fullname, s);
@ -1264,7 +1291,7 @@ bool upb_fielddef_haspresence(const upb_fielddef *f) {
/* Primitive field: return true unless there is a message that specifies
* presence should not exist. */
if (f->msg_is_symbolic || !f->msg.def) return true;
return f->msg.def->primitives_have_presence;
return f->msg.def->syntax == UPB_SYNTAX_PROTO2;
}
bool upb_fielddef_hassubdef(const upb_fielddef *f) {
@ -1323,7 +1350,7 @@ upb_msgdef *upb_msgdef_new(const void *owner) {
if (!upb_strtable_init(&m->ntof, UPB_CTYPE_PTR)) goto err2;
if (!upb_strtable_init(&m->ntoo, UPB_CTYPE_PTR)) goto err1;
m->map_entry = false;
m->primitives_have_presence = true;
m->syntax = UPB_SYNTAX_PROTO2;
return m;
err1:
@ -1346,7 +1373,7 @@ upb_msgdef *upb_msgdef_dup(const upb_msgdef *m, const void *owner) {
upb_def_fullname(upb_msgdef_upcast(m)),
NULL);
newm->map_entry = m->map_entry;
newm->primitives_have_presence = m->primitives_have_presence;
newm->syntax = m->syntax;
UPB_ASSERT_VAR(ok, ok);
for(upb_msg_field_begin(&i, m);
!upb_msg_field_done(&i);
@ -1380,6 +1407,10 @@ const char *upb_msgdef_fullname(const upb_msgdef *m) {
return upb_def_fullname(upb_msgdef_upcast(m));
}
const char *upb_msgdef_name(const upb_msgdef *m) {
return upb_def_name(upb_msgdef_upcast(m));
}
bool upb_msgdef_setfullname(upb_msgdef *m, const char *fullname,
upb_status *s) {
return upb_def_setfullname(upb_msgdef_upcast_mutable(m), fullname, s);
@ -1491,11 +1522,6 @@ bool upb_msgdef_addoneof(upb_msgdef *m, upb_oneofdef *o, const void *ref_donor,
return true;
}
void upb_msgdef_setprimitiveshavepresence(upb_msgdef *m, bool have_presence) {
assert(!upb_msgdef_isfrozen(m));
m->primitives_have_presence = have_presence;
}
const upb_fielddef *upb_msgdef_itof(const upb_msgdef *m, uint32_t i) {
upb_value val;
return upb_inttable_lookup32(&m->itof, i, &val) ?
@ -1757,3 +1783,188 @@ upb_fielddef *upb_oneof_iter_field(const upb_oneof_iter *iter) {
void upb_oneof_iter_setdone(upb_oneof_iter *iter) {
upb_inttable_iter_setdone(iter);
}
/* upb_filedef ****************************************************************/
static void visitfiledef(const upb_refcounted *r, upb_refcounted_visit *visit,
void *closure) {
const upb_filedef *f = (const upb_filedef*)r;
size_t i;
for(i = 0; i < upb_filedef_defcount(f); i++) {
visit(r, upb_def_upcast(upb_filedef_def(f, i)), closure);
}
}
static void freefiledef(upb_refcounted *r) {
upb_filedef *f = (upb_filedef*)r;
size_t i;
for(i = 0; i < upb_filedef_depcount(f); i++) {
upb_filedef_unref(upb_filedef_dep(f, i), f);
}
upb_inttable_uninit(&f->defs);
upb_inttable_uninit(&f->deps);
free((void*)f->name);
free((void*)f->package);
free(f);
}
upb_filedef *upb_filedef_new(const void *owner) {
static const struct upb_refcounted_vtbl vtbl = {visitfiledef, freefiledef};
upb_filedef *f = malloc(sizeof(*f));
if (!f) {
return NULL;
}
f->package = NULL;
f->name = NULL;
f->syntax = UPB_SYNTAX_PROTO2;
if (!upb_refcounted_init(upb_filedef_upcast_mutable(f), &vtbl, owner)) {
goto err;
}
if (!upb_inttable_init(&f->defs, UPB_CTYPE_CONSTPTR)) {
goto err;
}
if (!upb_inttable_init(&f->deps, UPB_CTYPE_CONSTPTR)) {
goto err2;
}
return f;
err2:
upb_inttable_uninit(&f->defs);
err:
free(f);
return NULL;
}
const char *upb_filedef_name(const upb_filedef *f) {
return f->name;
}
const char *upb_filedef_package(const upb_filedef *f) {
return f->package;
}
upb_syntax_t upb_filedef_syntax(const upb_filedef *f) {
return f->syntax;
}
size_t upb_filedef_defcount(const upb_filedef *f) {
return upb_inttable_count(&f->defs);
}
size_t upb_filedef_depcount(const upb_filedef *f) {
return upb_inttable_count(&f->deps);
}
const upb_def *upb_filedef_def(const upb_filedef *f, size_t i) {
upb_value v;
if (upb_inttable_lookup32(&f->defs, i, &v)) {
return upb_value_getconstptr(v);
} else {
return NULL;
}
}
const upb_filedef *upb_filedef_dep(const upb_filedef *f, size_t i) {
upb_value v;
if (upb_inttable_lookup32(&f->deps, i, &v)) {
return upb_value_getconstptr(v);
} else {
return NULL;
}
}
bool upb_filedef_setname(upb_filedef *f, const char *name, upb_status *s) {
name = upb_strdup(name);
if (!name) {
upb_status_seterrmsg(s, "Out of memory");
return false;
}
free((void*)f->name);
f->name = name;
return true;
}
bool upb_filedef_setpackage(upb_filedef *f, const char *package,
upb_status *s) {
if (!upb_isident(package, strlen(package), true, s)) return false;
package = upb_strdup(package);
if (!package) {
upb_status_seterrmsg(s, "Out of memory");
return false;
}
free((void*)f->package);
f->package = package;
return true;
}
bool upb_filedef_setsyntax(upb_filedef *f, upb_syntax_t syntax,
upb_status *s) {
UPB_UNUSED(s);
if (syntax != UPB_SYNTAX_PROTO2 &&
syntax != UPB_SYNTAX_PROTO3) {
upb_status_seterrmsg(s, "Unknown syntax value.");
return false;
}
f->syntax = syntax;
{
/* Set all messages in this file to match. */
size_t i;
for (i = 0; i < upb_filedef_defcount(f); i++) {
/* Casting const away is safe since all defs in mutable filedef must
* also be mutable. */
upb_def *def = (upb_def*)upb_filedef_def(f, i);
upb_msgdef *m = upb_dyncast_msgdef_mutable(def);
if (m) {
m->syntax = syntax;
}
}
}
return true;
}
bool upb_filedef_adddef(upb_filedef *f, upb_def *def, const void *ref_donor,
upb_status *s) {
if (def->file) {
upb_status_seterrmsg(s, "Def is already part of another filedef.");
return false;
}
if (upb_inttable_push(&f->defs, upb_value_constptr(def))) {
def->file = f;
upb_ref2(def, f);
if (ref_donor) upb_def_unref(def, ref_donor);
if (def->type == UPB_DEF_MSG) {
upb_downcast_msgdef_mutable(def)->syntax = f->syntax;
}
return true;
} else {
upb_status_seterrmsg(s, "Out of memory.");
return false;
}
}
bool upb_filedef_adddep(upb_filedef *f, const upb_filedef *dep) {
if (upb_inttable_push(&f->deps, upb_value_constptr(dep))) {
/* Regular ref instead of ref2 because files can't form cycles. */
upb_filedef_ref(dep, f);
return true;
} else {
return false;
}
}

@ -4,6 +4,7 @@
**
** - upb::MessageDef (upb_msgdef): describes a "message" construct.
** - upb::FieldDef (upb_fielddef): describes a message field.
** - upb::FileDef (upb_filedef): describes a .proto file and its defs.
** - upb::EnumDef (upb_enumdef): describes an enum.
** - upb::OneofDef (upb_oneofdef): describes a oneof.
** - upb::Def (upb_def): base class of all the others.
@ -31,6 +32,7 @@ namespace upb {
class Def;
class EnumDef;
class FieldDef;
class FileDef;
class MessageDef;
class OneofDef;
}
@ -39,6 +41,8 @@ class OneofDef;
UPB_DECLARE_DERIVED_TYPE(upb::Def, upb::RefCounted, upb_def, upb_refcounted)
UPB_DECLARE_DERIVED_TYPE(upb::OneofDef, upb::RefCounted, upb_oneofdef,
upb_refcounted)
UPB_DECLARE_DERIVED_TYPE(upb::FileDef, upb::RefCounted, upb_filedef,
upb_refcounted)
/* The maximum message depth that the type graph can have. This is a resource
* limit for the C stack since we sometimes need to recursively traverse the
@ -82,6 +86,9 @@ class upb::Def {
/* "fullname" is the def's fully-qualified name (eg. foo.bar.Message). */
const char *full_name() const;
/* The final part of a def's name (eg. Message). */
const char *name() const;
/* The def must be mutable. Caller retains ownership of fullname. Defs are
* not required to have a name; if a def has no name when it is frozen, it
* will remain an anonymous def. On failure, returns false and details in "s"
@ -89,6 +96,11 @@ class upb::Def {
bool set_full_name(const char* fullname, upb::Status* s);
bool set_full_name(const std::string &fullname, upb::Status* s);
/* The file in which this def appears. It is not necessary to add a def to a
* file (and consequently the accessor may return NULL). Set this by calling
* file->Add(def). */
FileDef* file() const;
/* Freezes the given defs; this validates all constraints and marks the defs
* as frozen (read-only). "defs" may not contain any fielddefs, but fields
* of any msgdefs will be frozen.
@ -100,7 +112,7 @@ class upb::Def {
*
* After this operation succeeds, the finalized defs must only be accessed
* through a const pointer! */
static bool Freeze(Def* const* defs, int n, Status* status);
static bool Freeze(Def* const* defs, size_t n, Status* status);
static bool Freeze(const std::vector<Def*>& defs, Status* status);
private:
@ -119,8 +131,13 @@ UPB_REFCOUNTED_CMETHODS(upb_def, upb_def_upcast)
upb_deftype_t upb_def_type(const upb_def *d);
const char *upb_def_fullname(const upb_def *d);
const char *upb_def_name(const upb_def *d);
const upb_filedef *upb_def_file(const upb_def *d);
bool upb_def_setfullname(upb_def *def, const char *fullname, upb_status *s);
bool upb_def_freeze(upb_def *const *defs, int n, upb_status *s);
bool upb_def_freeze(upb_def *const *defs, size_t n, upb_status *s);
/* Temporary API: for internal use only. */
bool _upb_def_validate(upb_def *const*defs, size_t n, upb_status *s);
UPB_END_EXTERN_C
@ -661,6 +678,7 @@ class upb::MessageDef {
/* Functionality from upb::Def. */
const char* full_name() const;
const char* name() const;
bool set_full_name(const char* fullname, Status* s);
bool set_full_name(const std::string& fullname, Status* s);
@ -894,6 +912,7 @@ UPB_REFCOUNTED_CMETHODS(upb_msgdef, upb_msgdef_upcast2)
bool upb_msgdef_freeze(upb_msgdef *m, upb_status *status);
const char *upb_msgdef_fullname(const upb_msgdef *m);
const char *upb_msgdef_name(const upb_msgdef *m);
bool upb_msgdef_setfullname(upb_msgdef *m, const char *fullname, upb_status *s);
upb_msgdef *upb_msgdef_dup(const upb_msgdef *m, const void *owner);
@ -901,7 +920,6 @@ bool upb_msgdef_addfield(upb_msgdef *m, upb_fielddef *f, const void *ref_donor,
upb_status *s);
bool upb_msgdef_addoneof(upb_msgdef *m, upb_oneofdef *o, const void *ref_donor,
upb_status *s);
void upb_msgdef_setprimitiveshavepresence(upb_msgdef *m, bool have_presence);
/* Field lookup in a couple of different variations:
* - itof = int to field
@ -1000,6 +1018,7 @@ class upb::EnumDef {
/* Functionality from upb::Def. */
const char* full_name() const;
const char* name() const;
bool set_full_name(const char* fullname, Status* s);
bool set_full_name(const std::string& fullname, Status* s);
@ -1074,6 +1093,7 @@ bool upb_enumdef_freeze(upb_enumdef *e, upb_status *status);
/* From upb_def. */
const char *upb_enumdef_fullname(const upb_enumdef *e);
const char *upb_enumdef_name(const upb_enumdef *e);
bool upb_enumdef_setfullname(upb_enumdef *e, const char *fullname,
upb_status *s);
@ -1115,8 +1135,7 @@ typedef upb_inttable_iter upb_oneof_iter;
#ifdef __cplusplus
/* Class that represents a oneof. Its base class is upb::Def (convert with
* upb::upcast()). */
/* Class that represents a oneof. */
class upb::OneofDef {
public:
/* Returns NULL if memory allocation failed. */
@ -1125,9 +1144,6 @@ class upb::OneofDef {
/* upb::RefCounted methods like Ref()/Unref(). */
UPB_REFCOUNTED_CPPMETHODS
/* Functionality from upb::Def. */
const char* full_name() const;
/* Returns the MessageDef that owns this OneofDef. */
const MessageDef* containing_type() const;
@ -1135,6 +1151,7 @@ class upb::OneofDef {
* by name once added to a message def. */
const char* name() const;
bool set_name(const char* name, Status* s);
bool set_name(const std::string& name, Status* s);
/* Returns the number of fields currently defined in the oneof. */
int field_count() const;
@ -1264,6 +1281,125 @@ void upb_oneof_iter_setdone(upb_oneof_iter *iter);
UPB_END_EXTERN_C
/* upb::FileDef ***************************************************************/
typedef enum {
UPB_SYNTAX_PROTO2 = 2,
UPB_SYNTAX_PROTO3 = 3
} upb_syntax_t;
#ifdef __cplusplus
/* Class that represents a .proto file with some things defined in it.
*
* Many users won't care about FileDefs, but they are necessary if you want to
* read the values of file-level options. */
class upb::FileDef {
public:
/* Returns NULL if memory allocation failed. */
static reffed_ptr<FileDef> New();
/* upb::RefCounted methods like Ref()/Unref(). */
UPB_REFCOUNTED_CPPMETHODS
/* Get/set name of the file (eg. "foo/bar.proto"). */
const char* name() const;
bool set_name(const char* name, Status* s);
bool set_name(const std::string& name, Status* s);
/* Package name for definitions inside the file (eg. "foo.bar"). */
const char* package() const;
bool set_package(const char* package, Status* s);
/* Syntax for the file. Defaults to proto2. */
upb_syntax_t syntax() const;
void set_syntax(upb_syntax_t syntax);
/* Get the list of defs from the file. These are returned in the order that
* they were added to the FileDef. */
int def_count() const;
const Def* def(int index) const;
Def* def(int index);
/* Get the list of dependencies from the file. These are returned in the
* order that they were added to the FileDef. */
int dependency_count() const;
const FileDef* dependency(int index) const;
/* Adds defs to this file. The def must not already belong to another
* file.
*
* Note: this does *not* ensure that this def's name is unique in this file!
* Use a SymbolTable if you want to check this property. Especially since
* properly checking uniqueness would require a check across *all* files
* (including dependencies). */
bool AddDef(Def* def, Status* s);
bool AddMessage(MessageDef* m, Status* s);
bool AddEnum(EnumDef* e, Status* s);
bool AddExtension(FieldDef* f, Status* s);
/* Adds a dependency of this file. */
bool AddDependency(const FileDef* file);
/* Freezes this FileDef and all messages/enums under it. All subdefs must be
* resolved and all messages/enums must validate. Returns true if this
* succeeded.
*
* TODO(haberman): should we care whether the file's dependencies are frozen
* already? */
bool Freeze(Status* s);
private:
UPB_DISALLOW_POD_OPS(FileDef, upb::FileDef)
};
#endif
UPB_BEGIN_EXTERN_C
upb_filedef *upb_filedef_new(const void *owner);
/* Include upb_refcounted methods like upb_msgdef_ref(). */
UPB_REFCOUNTED_CMETHODS(upb_filedef, upb_filedef_upcast)
const char *upb_filedef_name(const upb_filedef *f);
const char *upb_filedef_package(const upb_filedef *f);
upb_syntax_t upb_filedef_syntax(const upb_filedef *f);
size_t upb_filedef_defcount(const upb_filedef *f);
size_t upb_filedef_depcount(const upb_filedef *f);
const upb_def *upb_filedef_def(const upb_filedef *f, size_t i);
const upb_filedef *upb_filedef_dep(const upb_filedef *f, size_t i);
bool upb_filedef_freeze(upb_filedef *f, upb_status *s);
bool upb_filedef_setname(upb_filedef *f, const char *name, upb_status *s);
bool upb_filedef_setpackage(upb_filedef *f, const char *package, upb_status *s);
bool upb_filedef_setsyntax(upb_filedef *f, upb_syntax_t syntax, upb_status *s);
bool upb_filedef_adddef(upb_filedef *f, upb_def *def, const void *ref_donor,
upb_status *s);
bool upb_filedef_adddep(upb_filedef *f, const upb_filedef *dep);
UPB_INLINE bool upb_filedef_addmsg(upb_filedef *f, upb_msgdef *m,
const void *ref_donor, upb_status *s) {
return upb_filedef_adddef(f, upb_msgdef_upcast_mutable(m), ref_donor, s);
}
UPB_INLINE bool upb_filedef_addenum(upb_filedef *f, upb_enumdef *e,
const void *ref_donor, upb_status *s) {
return upb_filedef_adddef(f, upb_enumdef_upcast_mutable(e), ref_donor, s);
}
UPB_INLINE bool upb_filedef_addext(upb_filedef *file, upb_fielddef *f,
const void *ref_donor, upb_status *s) {
return upb_filedef_adddef(file, upb_fielddef_upcast_mutable(f), ref_donor, s);
}
UPB_INLINE upb_def *upb_filedef_mutabledef(upb_filedef *f, int i) {
return (upb_def*)upb_filedef_def(f, i);
}
UPB_END_EXTERN_C
#ifdef __cplusplus
UPB_INLINE const char* upb_safecstr(const std::string& str) {
@ -1279,13 +1415,14 @@ inline Def* Def::Dup(const void* owner) const {
}
inline Def::Type Def::def_type() const { return upb_def_type(this); }
inline const char* Def::full_name() const { return upb_def_fullname(this); }
inline const char* Def::name() const { return upb_def_name(this); }
inline bool Def::set_full_name(const char* fullname, Status* s) {
return upb_def_setfullname(this, fullname, s);
}
inline bool Def::set_full_name(const std::string& fullname, Status* s) {
return upb_def_setfullname(this, upb_safecstr(fullname), s);
}
inline bool Def::Freeze(Def* const* defs, int n, Status* status) {
inline bool Def::Freeze(Def* const* defs, size_t n, Status* status) {
return upb_def_freeze(defs, n, status);
}
inline bool Def::Freeze(const std::vector<Def*>& defs, Status* status) {
@ -1511,6 +1648,9 @@ inline reffed_ptr<MessageDef> MessageDef::New() {
inline const char *MessageDef::full_name() const {
return upb_msgdef_fullname(this);
}
inline const char *MessageDef::name() const {
return upb_msgdef_name(this);
}
inline bool MessageDef::set_full_name(const char* fullname, Status* s) {
return upb_msgdef_setfullname(this, fullname, s);
}
@ -1698,6 +1838,9 @@ inline reffed_ptr<EnumDef> EnumDef::New() {
inline const char* EnumDef::full_name() const {
return upb_enumdef_fullname(this);
}
inline const char* EnumDef::name() const {
return upb_enumdef_name(this);
}
inline bool EnumDef::set_full_name(const char* fullname, Status* s) {
return upb_enumdef_setfullname(this, fullname, s);
}
@ -1747,9 +1890,6 @@ inline reffed_ptr<OneofDef> OneofDef::New() {
upb_oneofdef *o = upb_oneofdef_new(&o);
return reffed_ptr<OneofDef>(o, &o);
}
inline const char* OneofDef::full_name() const {
return upb_oneofdef_name(this);
}
inline const MessageDef* OneofDef::containing_type() const {
return upb_oneofdef_containingtype(this);
@ -1760,6 +1900,9 @@ inline const char* OneofDef::name() const {
inline bool OneofDef::set_name(const char* name, Status* s) {
return upb_oneofdef_setname(this, name, s);
}
inline bool OneofDef::set_name(const std::string& name, Status* s) {
return upb_oneofdef_setname(this, upb_safecstr(name), s);
}
inline int OneofDef::field_count() const {
return upb_oneofdef_numfields(this);
}
@ -1828,6 +1971,57 @@ inline bool OneofDef::const_iterator::operator!=(
return !(*this == other);
}
inline reffed_ptr<FileDef> FileDef::New() {
upb_filedef *f = upb_filedef_new(&f);
return reffed_ptr<FileDef>(f, &f);
}
inline const char* FileDef::name() const {
return upb_filedef_name(this);
}
inline bool FileDef::set_name(const char* name, Status* s) {
return upb_filedef_setname(this, name, s);
}
inline bool FileDef::set_name(const std::string& name, Status* s) {
return upb_filedef_setname(this, upb_safecstr(name), s);
}
inline const char* FileDef::package() const {
return upb_filedef_package(this);
}
inline bool FileDef::set_package(const char* package, Status* s) {
return upb_filedef_setpackage(this, package, s);
}
inline int FileDef::def_count() const {
return upb_filedef_defcount(this);
}
inline const Def* FileDef::def(int index) const {
return upb_filedef_def(this, index);
}
inline Def* FileDef::def(int index) {
return const_cast<Def*>(upb_filedef_def(this, index));
}
inline int FileDef::dependency_count() const {
return upb_filedef_depcount(this);
}
inline const FileDef* FileDef::dependency(int index) const {
return upb_filedef_dep(this, index);
}
inline bool FileDef::AddDef(Def* def, Status* s) {
return upb_filedef_adddef(this, def, NULL, s);
}
inline bool FileDef::AddMessage(MessageDef* m, Status* s) {
return upb_filedef_addmsg(this, m, NULL, s);
}
inline bool FileDef::AddEnum(EnumDef* e, Status* s) {
return upb_filedef_addenum(this, e, NULL, s);
}
inline bool FileDef::AddExtension(FieldDef* f, Status* s) {
return upb_filedef_addext(this, f, NULL, s);
}
inline bool FileDef::AddDependency(const FileDef* file) {
return upb_filedef_adddep(this, file);
}
} /* namespace upb */
#endif

@ -1,938 +0,0 @@
/* This file contains accessors for a set of compiled-in defs.
* Note that unlike Google's protobuf, it does *not* define
* generated classes or any other kind of data structure for
* actually storing protobufs. It only contains *defs* which
* let you reflect over a protobuf *schema*.
*/
/* This file was generated by upbc (the upb compiler).
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_UPB_H_
#define GOOGLE_PROTOBUF_DESCRIPTOR_UPB_H_
#include "upb/def.h"
#include "upb/symtab.h"
#ifdef __cplusplus
UPB_BEGIN_EXTERN_C
#endif
/* 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;
/* Selectors */
/* google.protobuf.DescriptorProto */
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_STARTSUBMSG 3
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_STARTSUBMSG 4
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_STARTSUBMSG 5
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_STARTSUBMSG 6
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_OPTIONS_STARTSUBMSG 7
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_ONEOF_DECL_STARTSUBMSG 8
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_RESERVED_RANGE_STARTSUBMSG 9
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_STARTSEQ 10
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_ENDSEQ 11
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_ENDSUBMSG 12
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_STARTSEQ 13
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_ENDSEQ 14
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_ENDSUBMSG 15
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_STARTSEQ 16
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_ENDSEQ 17
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_ENDSUBMSG 18
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_STARTSEQ 19
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_ENDSEQ 20
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_ENDSUBMSG 21
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_STARTSEQ 22
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_ENDSEQ 23
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_ENDSUBMSG 24
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_OPTIONS_ENDSUBMSG 25
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_ONEOF_DECL_STARTSEQ 26
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_ONEOF_DECL_ENDSEQ 27
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_ONEOF_DECL_ENDSUBMSG 28
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_RESERVED_RANGE_STARTSEQ 29
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_RESERVED_RANGE_ENDSEQ 30
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_RESERVED_RANGE_ENDSUBMSG 31
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_NAME_STRING 32
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_NAME_STARTSTR 33
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_NAME_ENDSTR 34
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_RESERVED_NAME_STARTSEQ 35
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_RESERVED_NAME_ENDSEQ 36
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_RESERVED_NAME_STRING 37
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_RESERVED_NAME_STARTSTR 38
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_RESERVED_NAME_ENDSTR 39
/* google.protobuf.DescriptorProto.ExtensionRange */
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSIONRANGE_START_INT32 2
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSIONRANGE_END_INT32 3
/* google.protobuf.DescriptorProto.ReservedRange */
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_RESERVEDRANGE_START_INT32 2
#define SEL_GOOGLE_PROTOBUF_DESCRIPTORPROTO_RESERVEDRANGE_END_INT32 3
/* google.protobuf.EnumDescriptorProto */
#define SEL_GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 3
#define SEL_GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_STARTSEQ 4
#define SEL_GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_ENDSEQ 5
#define SEL_GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_ENDSUBMSG 6
#define SEL_GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 7
#define SEL_GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_NAME_STRING 8
#define SEL_GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_NAME_STARTSTR 9
#define SEL_GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_NAME_ENDSTR 10
/* google.protobuf.EnumOptions */
#define SEL_GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3
#define SEL_GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4
#define SEL_GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5
#define SEL_GOOGLE_PROTOBUF_ENUMOPTIONS_ALLOW_ALIAS_BOOL 6
#define SEL_GOOGLE_PROTOBUF_ENUMOPTIONS_DEPRECATED_BOOL 7
/* google.protobuf.EnumValueDescriptorProto */
#define SEL_GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 3
#define SEL_GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_NAME_STRING 4
#define SEL_GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_NAME_STARTSTR 5
#define SEL_GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_NAME_ENDSTR 6
#define SEL_GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_NUMBER_INT32 7
/* google.protobuf.EnumValueOptions */
#define SEL_GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3
#define SEL_GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4
#define SEL_GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5
#define SEL_GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_DEPRECATED_BOOL 6
/* google.protobuf.FieldDescriptorProto */
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 3
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_NAME_STRING 4
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_NAME_STARTSTR 5
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_NAME_ENDSTR 6
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_EXTENDEE_STRING 7
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_EXTENDEE_STARTSTR 8
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_EXTENDEE_ENDSTR 9
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_NUMBER_INT32 10
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_LABEL_INT32 11
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_INT32 12
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_NAME_STRING 13
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_NAME_STARTSTR 14
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_NAME_ENDSTR 15
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_DEFAULT_VALUE_STRING 16
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_DEFAULT_VALUE_STARTSTR 17
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_DEFAULT_VALUE_ENDSTR 18
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_ONEOF_INDEX_INT32 19
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_JSON_NAME_STRING 20
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_JSON_NAME_STARTSTR 21
#define SEL_GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_JSON_NAME_ENDSTR 22
/* google.protobuf.FieldOptions */
#define SEL_GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3
#define SEL_GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4
#define SEL_GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5
#define SEL_GOOGLE_PROTOBUF_FIELDOPTIONS_CTYPE_INT32 6
#define SEL_GOOGLE_PROTOBUF_FIELDOPTIONS_PACKED_BOOL 7
#define SEL_GOOGLE_PROTOBUF_FIELDOPTIONS_DEPRECATED_BOOL 8
#define SEL_GOOGLE_PROTOBUF_FIELDOPTIONS_LAZY_BOOL 9
#define SEL_GOOGLE_PROTOBUF_FIELDOPTIONS_JSTYPE_INT32 10
#define SEL_GOOGLE_PROTOBUF_FIELDOPTIONS_WEAK_BOOL 11
/* google.protobuf.FileDescriptorProto */
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_STARTSUBMSG 3
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_STARTSUBMSG 4
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_STARTSUBMSG 5
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 6
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SOURCE_CODE_INFO_STARTSUBMSG 7
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_STARTSEQ 8
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_ENDSEQ 9
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_ENDSUBMSG 10
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_STARTSEQ 11
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_ENDSEQ 12
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_ENDSUBMSG 13
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_STARTSEQ 14
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_ENDSEQ 15
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_ENDSUBMSG 16
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_STARTSEQ 17
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_ENDSEQ 18
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_ENDSUBMSG 19
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 20
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SOURCE_CODE_INFO_ENDSUBMSG 21
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_NAME_STRING 22
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_NAME_STARTSTR 23
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_NAME_ENDSTR 24
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PACKAGE_STRING 25
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PACKAGE_STARTSTR 26
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PACKAGE_ENDSTR 27
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_DEPENDENCY_STARTSEQ 28
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_DEPENDENCY_ENDSEQ 29
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_DEPENDENCY_STRING 30
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_DEPENDENCY_STARTSTR 31
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_DEPENDENCY_ENDSTR 32
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PUBLIC_DEPENDENCY_STARTSEQ 33
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PUBLIC_DEPENDENCY_ENDSEQ 34
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PUBLIC_DEPENDENCY_INT32 35
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_WEAK_DEPENDENCY_STARTSEQ 36
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_WEAK_DEPENDENCY_ENDSEQ 37
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_WEAK_DEPENDENCY_INT32 38
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SYNTAX_STRING 39
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SYNTAX_STARTSTR 40
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SYNTAX_ENDSTR 41
/* google.protobuf.FileDescriptorSet */
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_STARTSEQ 3
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_ENDSEQ 4
#define SEL_GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_ENDSUBMSG 5
/* google.protobuf.FileOptions */
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_PACKAGE_STRING 6
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_PACKAGE_STARTSTR 7
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_PACKAGE_ENDSTR 8
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_OUTER_CLASSNAME_STRING 9
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_OUTER_CLASSNAME_STARTSTR 10
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_OUTER_CLASSNAME_ENDSTR 11
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_OPTIMIZE_FOR_INT32 12
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_MULTIPLE_FILES_BOOL 13
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_GO_PACKAGE_STRING 14
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_GO_PACKAGE_STARTSTR 15
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_GO_PACKAGE_ENDSTR 16
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_CC_GENERIC_SERVICES_BOOL 17
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_GENERIC_SERVICES_BOOL 18
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_PY_GENERIC_SERVICES_BOOL 19
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_GENERATE_EQUALS_AND_HASH_BOOL 20
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_DEPRECATED_BOOL 21
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_STRING_CHECK_UTF8_BOOL 22
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_CC_ENABLE_ARENAS_BOOL 23
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_OBJC_CLASS_PREFIX_STRING 24
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_OBJC_CLASS_PREFIX_STARTSTR 25
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_OBJC_CLASS_PREFIX_ENDSTR 26
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_CSHARP_NAMESPACE_STRING 27
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_CSHARP_NAMESPACE_STARTSTR 28
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_CSHARP_NAMESPACE_ENDSTR 29
#define SEL_GOOGLE_PROTOBUF_FILEOPTIONS_JAVANANO_USE_DEPRECATED_PACKAGE_BOOL 30
/* google.protobuf.MessageOptions */
#define SEL_GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3
#define SEL_GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4
#define SEL_GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5
#define SEL_GOOGLE_PROTOBUF_MESSAGEOPTIONS_MESSAGE_SET_WIRE_FORMAT_BOOL 6
#define SEL_GOOGLE_PROTOBUF_MESSAGEOPTIONS_NO_STANDARD_DESCRIPTOR_ACCESSOR_BOOL 7
#define SEL_GOOGLE_PROTOBUF_MESSAGEOPTIONS_DEPRECATED_BOOL 8
#define SEL_GOOGLE_PROTOBUF_MESSAGEOPTIONS_MAP_ENTRY_BOOL 9
/* google.protobuf.MethodDescriptorProto */
#define SEL_GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 3
#define SEL_GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_NAME_STRING 4
#define SEL_GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_NAME_STARTSTR 5
#define SEL_GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_NAME_ENDSTR 6
#define SEL_GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_INPUT_TYPE_STRING 7
#define SEL_GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_INPUT_TYPE_STARTSTR 8
#define SEL_GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_INPUT_TYPE_ENDSTR 9
#define SEL_GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OUTPUT_TYPE_STRING 10
#define SEL_GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OUTPUT_TYPE_STARTSTR 11
#define SEL_GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OUTPUT_TYPE_ENDSTR 12
#define SEL_GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_CLIENT_STREAMING_BOOL 13
#define SEL_GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_SERVER_STREAMING_BOOL 14
/* google.protobuf.MethodOptions */
#define SEL_GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3
#define SEL_GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4
#define SEL_GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5
#define SEL_GOOGLE_PROTOBUF_METHODOPTIONS_DEPRECATED_BOOL 6
/* google.protobuf.OneofDescriptorProto */
#define SEL_GOOGLE_PROTOBUF_ONEOFDESCRIPTORPROTO_NAME_STRING 2
#define SEL_GOOGLE_PROTOBUF_ONEOFDESCRIPTORPROTO_NAME_STARTSTR 3
#define SEL_GOOGLE_PROTOBUF_ONEOFDESCRIPTORPROTO_NAME_ENDSTR 4
/* google.protobuf.ServiceDescriptorProto */
#define SEL_GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 3
#define SEL_GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_STARTSEQ 4
#define SEL_GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_ENDSEQ 5
#define SEL_GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_ENDSUBMSG 6
#define SEL_GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 7
#define SEL_GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_NAME_STRING 8
#define SEL_GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_NAME_STARTSTR 9
#define SEL_GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_NAME_ENDSTR 10
/* google.protobuf.ServiceOptions */
#define SEL_GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3
#define SEL_GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4
#define SEL_GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5
#define SEL_GOOGLE_PROTOBUF_SERVICEOPTIONS_DEPRECATED_BOOL 6
/* google.protobuf.SourceCodeInfo */
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_STARTSEQ 3
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_ENDSEQ 4
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_ENDSUBMSG 5
/* google.protobuf.SourceCodeInfo.Location */
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_PATH_STARTSEQ 2
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_PATH_ENDSEQ 3
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_PATH_INT32 4
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_SPAN_STARTSEQ 5
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_SPAN_ENDSEQ 6
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_SPAN_INT32 7
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_LEADING_COMMENTS_STRING 8
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_LEADING_COMMENTS_STARTSTR 9
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_LEADING_COMMENTS_ENDSTR 10
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_TRAILING_COMMENTS_STRING 11
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_TRAILING_COMMENTS_STARTSTR 12
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_TRAILING_COMMENTS_ENDSTR 13
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_LEADING_DETACHED_COMMENTS_STARTSEQ 14
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_LEADING_DETACHED_COMMENTS_ENDSEQ 15
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_LEADING_DETACHED_COMMENTS_STRING 16
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_LEADING_DETACHED_COMMENTS_STARTSTR 17
#define SEL_GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_LEADING_DETACHED_COMMENTS_ENDSTR 18
/* google.protobuf.UninterpretedOption */
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_STARTSUBMSG 2
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_STARTSEQ 3
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_ENDSEQ 4
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_ENDSUBMSG 5
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_IDENTIFIER_VALUE_STRING 6
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_IDENTIFIER_VALUE_STARTSTR 7
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_IDENTIFIER_VALUE_ENDSTR 8
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_POSITIVE_INT_VALUE_UINT64 9
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NEGATIVE_INT_VALUE_INT64 10
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_DOUBLE_VALUE_DOUBLE 11
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_STRING_VALUE_STRING 12
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_STRING_VALUE_STARTSTR 13
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_STRING_VALUE_ENDSTR 14
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_AGGREGATE_VALUE_STRING 15
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_AGGREGATE_VALUE_STARTSTR 16
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_AGGREGATE_VALUE_ENDSTR 17
/* google.protobuf.UninterpretedOption.NamePart */
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAMEPART_NAME_PART_STRING 2
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAMEPART_NAME_PART_STARTSTR 3
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAMEPART_NAME_PART_ENDSTR 4
#define SEL_GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAMEPART_IS_EXTENSION_BOOL 5
const upb_symtab *upbdefs_google_protobuf_descriptor(const void *owner);
/* MessageDefs */
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_DescriptorProto(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.DescriptorProto");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_ExtensionRange(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.DescriptorProto.ExtensionRange");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_ReservedRange(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.DescriptorProto.ReservedRange");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_EnumDescriptorProto(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.EnumDescriptorProto");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_EnumOptions(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.EnumOptions");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_EnumValueDescriptorProto(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.EnumValueDescriptorProto");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_EnumValueOptions(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.EnumValueOptions");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_FieldDescriptorProto(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.FieldDescriptorProto");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_FieldOptions(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.FieldOptions");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_FileDescriptorProto(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.FileDescriptorProto");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_FileDescriptorSet(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.FileDescriptorSet");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_FileOptions(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.FileOptions");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_MessageOptions(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.MessageOptions");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_MethodDescriptorProto(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.MethodDescriptorProto");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_MethodOptions(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.MethodOptions");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_OneofDescriptorProto(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.OneofDescriptorProto");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_ServiceDescriptorProto(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.ServiceDescriptorProto");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_ServiceOptions(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.ServiceOptions");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_SourceCodeInfo(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.SourceCodeInfo");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_SourceCodeInfo_Location(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.SourceCodeInfo.Location");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_UninterpretedOption(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.UninterpretedOption");
assert(m);
return m;
}
UPB_INLINE const upb_msgdef *upbdefs_google_protobuf_UninterpretedOption_NamePart(const upb_symtab *s) {
const upb_msgdef *m = upb_symtab_lookupmsg(s, "google.protobuf.UninterpretedOption.NamePart");
assert(m);
return m;
}
/* EnumDefs */
UPB_INLINE const upb_enumdef *upbdefs_google_protobuf_FieldDescriptorProto_Label(const upb_symtab *s) {
const upb_enumdef *e = upb_symtab_lookupenum(s, "google.protobuf.FieldDescriptorProto.Label");
assert(e);
return e;
}
UPB_INLINE const upb_enumdef *upbdefs_google_protobuf_FieldDescriptorProto_Type(const upb_symtab *s) {
const upb_enumdef *e = upb_symtab_lookupenum(s, "google.protobuf.FieldDescriptorProto.Type");
assert(e);
return e;
}
UPB_INLINE const upb_enumdef *upbdefs_google_protobuf_FieldOptions_CType(const upb_symtab *s) {
const upb_enumdef *e = upb_symtab_lookupenum(s, "google.protobuf.FieldOptions.CType");
assert(e);
return e;
}
UPB_INLINE const upb_enumdef *upbdefs_google_protobuf_FieldOptions_JSType(const upb_symtab *s) {
const upb_enumdef *e = upb_symtab_lookupenum(s, "google.protobuf.FieldOptions.JSType");
assert(e);
return e;
}
UPB_INLINE const upb_enumdef *upbdefs_google_protobuf_FileOptions_OptimizeMode(const upb_symtab *s) {
const upb_enumdef *e = upb_symtab_lookupenum(s, "google.protobuf.FileOptions.OptimizeMode");
assert(e);
return e;
}
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_ExtensionRange_end(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_DescriptorProto_ExtensionRange(s), 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_ExtensionRange_start(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_DescriptorProto_ExtensionRange(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_ReservedRange_end(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_DescriptorProto_ReservedRange(s), 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_ReservedRange_start(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_DescriptorProto_ReservedRange(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_enum_type(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_DescriptorProto(s), 4); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_extension(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_DescriptorProto(s), 6); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_extension_range(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_DescriptorProto(s), 5); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_field(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_DescriptorProto(s), 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_name(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_DescriptorProto(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_nested_type(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_DescriptorProto(s), 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_oneof_decl(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_DescriptorProto(s), 8); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_options(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_DescriptorProto(s), 7); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_reserved_name(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_DescriptorProto(s), 10); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_reserved_range(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_DescriptorProto(s), 9); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumDescriptorProto_name(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_EnumDescriptorProto(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumDescriptorProto_options(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_EnumDescriptorProto(s), 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumDescriptorProto_value(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_EnumDescriptorProto(s), 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumOptions_allow_alias(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_EnumOptions(s), 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumOptions_deprecated(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_EnumOptions(s), 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumOptions_uninterpreted_option(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_EnumOptions(s), 999); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumValueDescriptorProto_name(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_EnumValueDescriptorProto(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumValueDescriptorProto_number(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_EnumValueDescriptorProto(s), 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumValueDescriptorProto_options(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_EnumValueDescriptorProto(s), 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumValueOptions_deprecated(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_EnumValueOptions(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumValueOptions_uninterpreted_option(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_EnumValueOptions(s), 999); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_default_value(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldDescriptorProto(s), 7); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_extendee(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldDescriptorProto(s), 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_json_name(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldDescriptorProto(s), 10); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_label(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldDescriptorProto(s), 4); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_name(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldDescriptorProto(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_number(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldDescriptorProto(s), 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_oneof_index(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldDescriptorProto(s), 9); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_options(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldDescriptorProto(s), 8); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_type(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldDescriptorProto(s), 5); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_type_name(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldDescriptorProto(s), 6); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_ctype(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldOptions(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_deprecated(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldOptions(s), 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_jstype(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldOptions(s), 6); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_lazy(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldOptions(s), 5); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_packed(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldOptions(s), 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_uninterpreted_option(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldOptions(s), 999); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_weak(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FieldOptions(s), 10); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_dependency(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileDescriptorProto(s), 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_enum_type(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileDescriptorProto(s), 5); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_extension(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileDescriptorProto(s), 7); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_message_type(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileDescriptorProto(s), 4); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_name(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileDescriptorProto(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_options(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileDescriptorProto(s), 8); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_package(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileDescriptorProto(s), 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_public_dependency(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileDescriptorProto(s), 10); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_service(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileDescriptorProto(s), 6); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_source_code_info(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileDescriptorProto(s), 9); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_syntax(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileDescriptorProto(s), 12); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_weak_dependency(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileDescriptorProto(s), 11); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorSet_file(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileDescriptorSet(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_cc_enable_arenas(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileOptions(s), 31); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_cc_generic_services(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileOptions(s), 16); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_csharp_namespace(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileOptions(s), 37); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_deprecated(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileOptions(s), 23); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_go_package(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileOptions(s), 11); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_java_generate_equals_and_hash(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileOptions(s), 20); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_java_generic_services(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileOptions(s), 17); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_java_multiple_files(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileOptions(s), 10); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_java_outer_classname(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileOptions(s), 8); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_java_package(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileOptions(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_java_string_check_utf8(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileOptions(s), 27); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_javanano_use_deprecated_package(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileOptions(s), 38); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_objc_class_prefix(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileOptions(s), 36); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_optimize_for(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileOptions(s), 9); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_py_generic_services(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileOptions(s), 18); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_uninterpreted_option(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_FileOptions(s), 999); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_deprecated(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_MessageOptions(s), 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_map_entry(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_MessageOptions(s), 7); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_message_set_wire_format(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_MessageOptions(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_no_standard_descriptor_accessor(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_MessageOptions(s), 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_uninterpreted_option(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_MessageOptions(s), 999); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_client_streaming(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_MethodDescriptorProto(s), 5); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_input_type(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_MethodDescriptorProto(s), 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_name(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_MethodDescriptorProto(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_options(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_MethodDescriptorProto(s), 4); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_output_type(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_MethodDescriptorProto(s), 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_server_streaming(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_MethodDescriptorProto(s), 6); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodOptions_deprecated(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_MethodOptions(s), 33); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodOptions_uninterpreted_option(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_MethodOptions(s), 999); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_OneofDescriptorProto_name(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_OneofDescriptorProto(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_ServiceDescriptorProto_method(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_ServiceDescriptorProto(s), 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_ServiceDescriptorProto_name(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_ServiceDescriptorProto(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_ServiceDescriptorProto_options(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_ServiceDescriptorProto(s), 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_ServiceOptions_deprecated(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_ServiceOptions(s), 33); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_ServiceOptions_uninterpreted_option(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_ServiceOptions(s), 999); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_Location_leading_comments(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_SourceCodeInfo_Location(s), 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_SourceCodeInfo_Location(s), 6); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_Location_path(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_SourceCodeInfo_Location(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_Location_span(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_SourceCodeInfo_Location(s), 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_Location_trailing_comments(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_SourceCodeInfo_Location(s), 4); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_location(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_SourceCodeInfo(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_NamePart_is_extension(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_UninterpretedOption_NamePart(s), 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_NamePart_name_part(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_UninterpretedOption_NamePart(s), 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_aggregate_value(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_UninterpretedOption(s), 8); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_double_value(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_UninterpretedOption(s), 6); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_identifier_value(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_UninterpretedOption(s), 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_name(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_UninterpretedOption(s), 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_negative_int_value(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_UninterpretedOption(s), 5); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_positive_int_value(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_UninterpretedOption(s), 4); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_string_value(const upb_symtab *s) { return upb_msgdef_itof(upbdefs_google_protobuf_UninterpretedOption(s), 7); }
UPB_END_EXTERN_C
#ifdef __cplusplus
namespace upbdefs {
namespace google {
namespace protobuf {
namespace descriptor {
inline upb::reffed_ptr<const upb::SymbolTable> SymbolTable() {
const upb::SymbolTable* s = upbdefs_google_protobuf_descriptor(&s);
return upb::reffed_ptr<const upb::SymbolTable>(s, &s);
}
} /* namespace descriptor */
} /* namespace protobuf */
} /* namespace google */
#define RETURN_REFFED(type, func) \
const type* obj = func(upbdefs::google::protobuf::descriptor::SymbolTable().get()); \
return upb::reffed_ptr<const type>(obj);
namespace google {
namespace protobuf {
namespace DescriptorProto {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_DescriptorProto) }
inline upb::reffed_ptr<const upb::FieldDef> enum_type() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_DescriptorProto_enum_type) }
inline upb::reffed_ptr<const upb::FieldDef> extension() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_DescriptorProto_extension) }
inline upb::reffed_ptr<const upb::FieldDef> extension_range() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_DescriptorProto_extension_range) }
inline upb::reffed_ptr<const upb::FieldDef> field() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_DescriptorProto_field) }
inline upb::reffed_ptr<const upb::FieldDef> name() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_DescriptorProto_name) }
inline upb::reffed_ptr<const upb::FieldDef> nested_type() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_DescriptorProto_nested_type) }
inline upb::reffed_ptr<const upb::FieldDef> oneof_decl() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_DescriptorProto_oneof_decl) }
inline upb::reffed_ptr<const upb::FieldDef> options() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_DescriptorProto_options) }
inline upb::reffed_ptr<const upb::FieldDef> reserved_name() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_DescriptorProto_reserved_name) }
inline upb::reffed_ptr<const upb::FieldDef> reserved_range() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_DescriptorProto_reserved_range) }
} /* namespace DescriptorProto */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace DescriptorProto {
namespace ExtensionRange {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_DescriptorProto_ExtensionRange) }
inline upb::reffed_ptr<const upb::FieldDef> end() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_DescriptorProto_ExtensionRange_end) }
inline upb::reffed_ptr<const upb::FieldDef> start() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_DescriptorProto_ExtensionRange_start) }
} /* namespace ExtensionRange */
} /* namespace DescriptorProto */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace DescriptorProto {
namespace ReservedRange {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_DescriptorProto_ReservedRange) }
inline upb::reffed_ptr<const upb::FieldDef> end() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_DescriptorProto_ReservedRange_end) }
inline upb::reffed_ptr<const upb::FieldDef> start() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_DescriptorProto_ReservedRange_start) }
} /* namespace ReservedRange */
} /* namespace DescriptorProto */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace EnumDescriptorProto {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_EnumDescriptorProto) }
inline upb::reffed_ptr<const upb::FieldDef> name() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_EnumDescriptorProto_name) }
inline upb::reffed_ptr<const upb::FieldDef> options() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_EnumDescriptorProto_options) }
inline upb::reffed_ptr<const upb::FieldDef> value() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_EnumDescriptorProto_value) }
} /* namespace EnumDescriptorProto */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace EnumOptions {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_EnumOptions) }
inline upb::reffed_ptr<const upb::FieldDef> allow_alias() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_EnumOptions_allow_alias) }
inline upb::reffed_ptr<const upb::FieldDef> deprecated() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_EnumOptions_deprecated) }
inline upb::reffed_ptr<const upb::FieldDef> uninterpreted_option() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_EnumOptions_uninterpreted_option) }
} /* namespace EnumOptions */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace EnumValueDescriptorProto {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_EnumValueDescriptorProto) }
inline upb::reffed_ptr<const upb::FieldDef> name() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_EnumValueDescriptorProto_name) }
inline upb::reffed_ptr<const upb::FieldDef> number() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_EnumValueDescriptorProto_number) }
inline upb::reffed_ptr<const upb::FieldDef> options() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_EnumValueDescriptorProto_options) }
} /* namespace EnumValueDescriptorProto */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace EnumValueOptions {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_EnumValueOptions) }
inline upb::reffed_ptr<const upb::FieldDef> deprecated() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_EnumValueOptions_deprecated) }
inline upb::reffed_ptr<const upb::FieldDef> uninterpreted_option() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_EnumValueOptions_uninterpreted_option) }
} /* namespace EnumValueOptions */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace FieldDescriptorProto {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_FieldDescriptorProto) }
inline upb::reffed_ptr<const upb::FieldDef> default_value() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldDescriptorProto_default_value) }
inline upb::reffed_ptr<const upb::FieldDef> extendee() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldDescriptorProto_extendee) }
inline upb::reffed_ptr<const upb::FieldDef> json_name() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldDescriptorProto_json_name) }
inline upb::reffed_ptr<const upb::FieldDef> label() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldDescriptorProto_label) }
inline upb::reffed_ptr<const upb::FieldDef> name() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldDescriptorProto_name) }
inline upb::reffed_ptr<const upb::FieldDef> number() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldDescriptorProto_number) }
inline upb::reffed_ptr<const upb::FieldDef> oneof_index() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldDescriptorProto_oneof_index) }
inline upb::reffed_ptr<const upb::FieldDef> options() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldDescriptorProto_options) }
inline upb::reffed_ptr<const upb::FieldDef> type() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldDescriptorProto_type) }
inline upb::reffed_ptr<const upb::FieldDef> type_name() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldDescriptorProto_type_name) }
inline upb::reffed_ptr<const upb::EnumDef> Label() { RETURN_REFFED(upb::EnumDef, upbdefs_google_protobuf_FieldDescriptorProto_Label) }
inline upb::reffed_ptr<const upb::EnumDef> Type() { RETURN_REFFED(upb::EnumDef, upbdefs_google_protobuf_FieldDescriptorProto_Type) }
} /* namespace FieldDescriptorProto */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace FieldOptions {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_FieldOptions) }
inline upb::reffed_ptr<const upb::FieldDef> ctype() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldOptions_ctype) }
inline upb::reffed_ptr<const upb::FieldDef> deprecated() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldOptions_deprecated) }
inline upb::reffed_ptr<const upb::FieldDef> jstype() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldOptions_jstype) }
inline upb::reffed_ptr<const upb::FieldDef> lazy() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldOptions_lazy) }
inline upb::reffed_ptr<const upb::FieldDef> packed() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldOptions_packed) }
inline upb::reffed_ptr<const upb::FieldDef> uninterpreted_option() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldOptions_uninterpreted_option) }
inline upb::reffed_ptr<const upb::FieldDef> weak() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FieldOptions_weak) }
inline upb::reffed_ptr<const upb::EnumDef> CType() { RETURN_REFFED(upb::EnumDef, upbdefs_google_protobuf_FieldOptions_CType) }
inline upb::reffed_ptr<const upb::EnumDef> JSType() { RETURN_REFFED(upb::EnumDef, upbdefs_google_protobuf_FieldOptions_JSType) }
} /* namespace FieldOptions */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace FileDescriptorProto {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_FileDescriptorProto) }
inline upb::reffed_ptr<const upb::FieldDef> dependency() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileDescriptorProto_dependency) }
inline upb::reffed_ptr<const upb::FieldDef> enum_type() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileDescriptorProto_enum_type) }
inline upb::reffed_ptr<const upb::FieldDef> extension() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileDescriptorProto_extension) }
inline upb::reffed_ptr<const upb::FieldDef> message_type() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileDescriptorProto_message_type) }
inline upb::reffed_ptr<const upb::FieldDef> name() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileDescriptorProto_name) }
inline upb::reffed_ptr<const upb::FieldDef> options() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileDescriptorProto_options) }
inline upb::reffed_ptr<const upb::FieldDef> package() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileDescriptorProto_package) }
inline upb::reffed_ptr<const upb::FieldDef> public_dependency() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileDescriptorProto_public_dependency) }
inline upb::reffed_ptr<const upb::FieldDef> service() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileDescriptorProto_service) }
inline upb::reffed_ptr<const upb::FieldDef> source_code_info() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileDescriptorProto_source_code_info) }
inline upb::reffed_ptr<const upb::FieldDef> syntax() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileDescriptorProto_syntax) }
inline upb::reffed_ptr<const upb::FieldDef> weak_dependency() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileDescriptorProto_weak_dependency) }
} /* namespace FileDescriptorProto */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace FileDescriptorSet {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_FileDescriptorSet) }
inline upb::reffed_ptr<const upb::FieldDef> file() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileDescriptorSet_file) }
} /* namespace FileDescriptorSet */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace FileOptions {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_FileOptions) }
inline upb::reffed_ptr<const upb::FieldDef> cc_enable_arenas() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileOptions_cc_enable_arenas) }
inline upb::reffed_ptr<const upb::FieldDef> cc_generic_services() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileOptions_cc_generic_services) }
inline upb::reffed_ptr<const upb::FieldDef> csharp_namespace() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileOptions_csharp_namespace) }
inline upb::reffed_ptr<const upb::FieldDef> deprecated() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileOptions_deprecated) }
inline upb::reffed_ptr<const upb::FieldDef> go_package() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileOptions_go_package) }
inline upb::reffed_ptr<const upb::FieldDef> java_generate_equals_and_hash() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileOptions_java_generate_equals_and_hash) }
inline upb::reffed_ptr<const upb::FieldDef> java_generic_services() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileOptions_java_generic_services) }
inline upb::reffed_ptr<const upb::FieldDef> java_multiple_files() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileOptions_java_multiple_files) }
inline upb::reffed_ptr<const upb::FieldDef> java_outer_classname() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileOptions_java_outer_classname) }
inline upb::reffed_ptr<const upb::FieldDef> java_package() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileOptions_java_package) }
inline upb::reffed_ptr<const upb::FieldDef> java_string_check_utf8() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileOptions_java_string_check_utf8) }
inline upb::reffed_ptr<const upb::FieldDef> javanano_use_deprecated_package() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileOptions_javanano_use_deprecated_package) }
inline upb::reffed_ptr<const upb::FieldDef> objc_class_prefix() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileOptions_objc_class_prefix) }
inline upb::reffed_ptr<const upb::FieldDef> optimize_for() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileOptions_optimize_for) }
inline upb::reffed_ptr<const upb::FieldDef> py_generic_services() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileOptions_py_generic_services) }
inline upb::reffed_ptr<const upb::FieldDef> uninterpreted_option() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_FileOptions_uninterpreted_option) }
inline upb::reffed_ptr<const upb::EnumDef> OptimizeMode() { RETURN_REFFED(upb::EnumDef, upbdefs_google_protobuf_FileOptions_OptimizeMode) }
} /* namespace FileOptions */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace MessageOptions {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_MessageOptions) }
inline upb::reffed_ptr<const upb::FieldDef> deprecated() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_MessageOptions_deprecated) }
inline upb::reffed_ptr<const upb::FieldDef> map_entry() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_MessageOptions_map_entry) }
inline upb::reffed_ptr<const upb::FieldDef> message_set_wire_format() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_MessageOptions_message_set_wire_format) }
inline upb::reffed_ptr<const upb::FieldDef> no_standard_descriptor_accessor() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_MessageOptions_no_standard_descriptor_accessor) }
inline upb::reffed_ptr<const upb::FieldDef> uninterpreted_option() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_MessageOptions_uninterpreted_option) }
} /* namespace MessageOptions */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace MethodDescriptorProto {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_MethodDescriptorProto) }
inline upb::reffed_ptr<const upb::FieldDef> client_streaming() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_MethodDescriptorProto_client_streaming) }
inline upb::reffed_ptr<const upb::FieldDef> input_type() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_MethodDescriptorProto_input_type) }
inline upb::reffed_ptr<const upb::FieldDef> name() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_MethodDescriptorProto_name) }
inline upb::reffed_ptr<const upb::FieldDef> options() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_MethodDescriptorProto_options) }
inline upb::reffed_ptr<const upb::FieldDef> output_type() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_MethodDescriptorProto_output_type) }
inline upb::reffed_ptr<const upb::FieldDef> server_streaming() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_MethodDescriptorProto_server_streaming) }
} /* namespace MethodDescriptorProto */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace MethodOptions {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_MethodOptions) }
inline upb::reffed_ptr<const upb::FieldDef> deprecated() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_MethodOptions_deprecated) }
inline upb::reffed_ptr<const upb::FieldDef> uninterpreted_option() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_MethodOptions_uninterpreted_option) }
} /* namespace MethodOptions */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace OneofDescriptorProto {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_OneofDescriptorProto) }
inline upb::reffed_ptr<const upb::FieldDef> name() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_OneofDescriptorProto_name) }
} /* namespace OneofDescriptorProto */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace ServiceDescriptorProto {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_ServiceDescriptorProto) }
inline upb::reffed_ptr<const upb::FieldDef> method() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_ServiceDescriptorProto_method) }
inline upb::reffed_ptr<const upb::FieldDef> name() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_ServiceDescriptorProto_name) }
inline upb::reffed_ptr<const upb::FieldDef> options() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_ServiceDescriptorProto_options) }
} /* namespace ServiceDescriptorProto */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace ServiceOptions {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_ServiceOptions) }
inline upb::reffed_ptr<const upb::FieldDef> deprecated() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_ServiceOptions_deprecated) }
inline upb::reffed_ptr<const upb::FieldDef> uninterpreted_option() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_ServiceOptions_uninterpreted_option) }
} /* namespace ServiceOptions */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace SourceCodeInfo {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_SourceCodeInfo) }
inline upb::reffed_ptr<const upb::FieldDef> location() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_SourceCodeInfo_location) }
} /* namespace SourceCodeInfo */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace SourceCodeInfo {
namespace Location {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_SourceCodeInfo_Location) }
inline upb::reffed_ptr<const upb::FieldDef> leading_comments() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_SourceCodeInfo_Location_leading_comments) }
inline upb::reffed_ptr<const upb::FieldDef> leading_detached_comments() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_SourceCodeInfo_Location_leading_detached_comments) }
inline upb::reffed_ptr<const upb::FieldDef> path() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_SourceCodeInfo_Location_path) }
inline upb::reffed_ptr<const upb::FieldDef> span() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_SourceCodeInfo_Location_span) }
inline upb::reffed_ptr<const upb::FieldDef> trailing_comments() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_SourceCodeInfo_Location_trailing_comments) }
} /* namespace Location */
} /* namespace SourceCodeInfo */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace UninterpretedOption {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_UninterpretedOption) }
inline upb::reffed_ptr<const upb::FieldDef> aggregate_value() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_UninterpretedOption_aggregate_value) }
inline upb::reffed_ptr<const upb::FieldDef> double_value() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_UninterpretedOption_double_value) }
inline upb::reffed_ptr<const upb::FieldDef> identifier_value() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_UninterpretedOption_identifier_value) }
inline upb::reffed_ptr<const upb::FieldDef> name() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_UninterpretedOption_name) }
inline upb::reffed_ptr<const upb::FieldDef> negative_int_value() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_UninterpretedOption_negative_int_value) }
inline upb::reffed_ptr<const upb::FieldDef> positive_int_value() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_UninterpretedOption_positive_int_value) }
inline upb::reffed_ptr<const upb::FieldDef> string_value() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_UninterpretedOption_string_value) }
} /* namespace UninterpretedOption */
} /* namespace protobuf */
} /* namespace google */
namespace google {
namespace protobuf {
namespace UninterpretedOption {
namespace NamePart {
inline upb::reffed_ptr<const upb::MessageDef> MessageDef() { RETURN_REFFED(upb::MessageDef, upbdefs_google_protobuf_UninterpretedOption_NamePart) }
inline upb::reffed_ptr<const upb::FieldDef> is_extension() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_UninterpretedOption_NamePart_is_extension) }
inline upb::reffed_ptr<const upb::FieldDef> name_part() { RETURN_REFFED(upb::FieldDef, upbdefs_google_protobuf_UninterpretedOption_NamePart_name_part) }
} /* namespace NamePart */
} /* namespace UninterpretedOption */
} /* namespace protobuf */
} /* namespace google */
} /* namespace upbdefs */
#undef RETURN_REFFED
#endif /* __cplusplus */
#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_UPB_H_ */

@ -2,19 +2,20 @@
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <assert.h>
#include "upb/def.h"
#include "upb/structdefs.int.h"
#include "upb/symtab.h"
static const upb_msgdef msgs[22];
static const upb_fielddef fields[105];
static const upb_enumdef enums[5];
static const upb_tabent strentries[268];
static const upb_tabent strentries[236];
static const upb_tabent intentries[18];
static const upb_tabval arrays[184];
#ifdef UPB_DEBUG_REFS
static upb_inttable reftables[266];
static upb_inttable reftables[264];
#endif
static const upb_msgdef msgs[22] = {
@ -52,18 +53,18 @@ static const upb_fielddef fields[105] = {
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "ctype", 1, &msgs[8], (const upb_def*)(&enums[2]), 6, 1, {0},&reftables[56], &reftables[57]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "default_value", 7, &msgs[7], NULL, 16, 7, {0},&reftables[58], &reftables[59]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "dependency", 3, &msgs[9], NULL, 30, 8, {0},&reftables[60], &reftables[61]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 1, &msgs[6], NULL, 6, 1, {0},&reftables[62], &reftables[63]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[4], NULL, 7, 2, {0},&reftables[64], &reftables[65]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[17], NULL, 6, 1, {0},&reftables[66], &reftables[67]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[8], NULL, 8, 3, {0},&reftables[68], &reftables[69]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[14], NULL, 6, 1, {0},&reftables[70], &reftables[71]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[12], NULL, 8, 3, {0},&reftables[72], &reftables[73]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 23, &msgs[11], NULL, 21, 10, {0},&reftables[74], &reftables[75]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[12], NULL, 8, 3, {0},&reftables[62], &reftables[63]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[8], NULL, 8, 3, {0},&reftables[64], &reftables[65]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[14], NULL, 6, 1, {0},&reftables[66], &reftables[67]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 23, &msgs[11], NULL, 21, 10, {0},&reftables[68], &reftables[69]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[4], NULL, 7, 2, {0},&reftables[70], &reftables[71]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[17], NULL, 6, 1, {0},&reftables[72], &reftables[73]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 1, &msgs[6], NULL, 6, 1, {0},&reftables[74], &reftables[75]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_DOUBLE, 0, false, false, false, false, "double_value", 6, &msgs[20], NULL, 11, 4, {0},&reftables[76], &reftables[77]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "end", 2, &msgs[2], NULL, 3, 1, {0},&reftables[78], &reftables[79]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "end", 2, &msgs[1], NULL, 3, 1, {0},&reftables[80], &reftables[81]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 5, &msgs[9], (const upb_def*)(&msgs[3]), 13, 1, {0},&reftables[82], &reftables[83]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 4, &msgs[0], (const upb_def*)(&msgs[3]), 18, 2, {0},&reftables[84], &reftables[85]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 4, &msgs[0], (const upb_def*)(&msgs[3]), 18, 2, {0},&reftables[82], &reftables[83]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 5, &msgs[9], (const upb_def*)(&msgs[3]), 13, 1, {0},&reftables[84], &reftables[85]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "extendee", 2, &msgs[7], NULL, 7, 2, {0},&reftables[86], &reftables[87]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension", 6, &msgs[0], (const upb_def*)(&msgs[7]), 24, 4, {0},&reftables[88], &reftables[89]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension", 7, &msgs[9], (const upb_def*)(&msgs[7]), 19, 3, {0},&reftables[90], &reftables[91]),
@ -92,32 +93,32 @@ static const upb_fielddef fields[105] = {
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "message_set_wire_format", 1, &msgs[12], NULL, 6, 1, {0},&reftables[136], &reftables[137]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "message_type", 4, &msgs[9], (const upb_def*)(&msgs[0]), 10, 0, {0},&reftables[138], &reftables[139]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "method", 2, &msgs[16], (const upb_def*)(&msgs[13]), 6, 0, {0},&reftables[140], &reftables[141]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[9], NULL, 22, 6, {0},&reftables[142], &reftables[143]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[5], NULL, 4, 1, {0},&reftables[144], &reftables[145]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[13], NULL, 4, 1, {0},&reftables[146], &reftables[147]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[3], NULL, 8, 2, {0},&reftables[142], &reftables[143]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[15], NULL, 2, 0, {0},&reftables[144], &reftables[145]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "name", 2, &msgs[20], (const upb_def*)(&msgs[21]), 5, 0, {0},&reftables[146], &reftables[147]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[0], NULL, 32, 8, {0},&reftables[148], &reftables[149]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[3], NULL, 8, 2, {0},&reftables[150], &reftables[151]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[15], NULL, 2, 0, {0},&reftables[152], &reftables[153]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[16], NULL, 8, 2, {0},&reftables[154], &reftables[155]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[7], NULL, 4, 1, {0},&reftables[156], &reftables[157]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "name", 2, &msgs[20], (const upb_def*)(&msgs[21]), 5, 0, {0},&reftables[158], &reftables[159]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[5], NULL, 4, 1, {0},&reftables[150], &reftables[151]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[9], NULL, 22, 6, {0},&reftables[152], &reftables[153]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[7], NULL, 4, 1, {0},&reftables[154], &reftables[155]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[13], NULL, 4, 1, {0},&reftables[156], &reftables[157]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[16], NULL, 8, 2, {0},&reftables[158], &reftables[159]),
UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_STRING, 0, false, false, false, false, "name_part", 1, &msgs[21], NULL, 2, 0, {0},&reftables[160], &reftables[161]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT64, UPB_INTFMT_VARIABLE, false, false, false, false, "negative_int_value", 5, &msgs[20], NULL, 10, 3, {0},&reftables[162], &reftables[163]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "nested_type", 3, &msgs[0], (const upb_def*)(&msgs[0]), 15, 1, {0},&reftables[164], &reftables[165]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "no_standard_descriptor_accessor", 2, &msgs[12], NULL, 7, 2, {0},&reftables[166], &reftables[167]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 3, &msgs[7], NULL, 10, 3, {0},&reftables[168], &reftables[169]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 2, &msgs[5], NULL, 7, 2, {0},&reftables[170], &reftables[171]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 2, &msgs[5], NULL, 7, 2, {0},&reftables[168], &reftables[169]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 3, &msgs[7], NULL, 10, 3, {0},&reftables[170], &reftables[171]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "objc_class_prefix", 36, &msgs[11], NULL, 24, 13, {0},&reftables[172], &reftables[173]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "oneof_decl", 8, &msgs[0], (const upb_def*)(&msgs[15]), 28, 6, {0},&reftables[174], &reftables[175]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "oneof_index", 9, &msgs[7], NULL, 19, 8, {0},&reftables[176], &reftables[177]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "optimize_for", 9, &msgs[11], (const upb_def*)(&enums[4]), 12, 3, {0},&reftables[178], &reftables[179]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 4, &msgs[13], (const upb_def*)(&msgs[14]), 3, 0, {0},&reftables[180], &reftables[181]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[3], (const upb_def*)(&msgs[4]), 7, 1, {0},&reftables[182], &reftables[183]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 7, &msgs[0], (const upb_def*)(&msgs[12]), 25, 5, {0},&reftables[184], &reftables[185]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[5], (const upb_def*)(&msgs[6]), 3, 0, {0},&reftables[186], &reftables[187]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[9], (const upb_def*)(&msgs[11]), 20, 4, {0},&reftables[188], &reftables[189]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[16], (const upb_def*)(&msgs[17]), 7, 1, {0},&reftables[190], &reftables[191]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[7], (const upb_def*)(&msgs[8]), 3, 0, {0},&reftables[192], &reftables[193]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 7, &msgs[0], (const upb_def*)(&msgs[12]), 25, 5, {0},&reftables[180], &reftables[181]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[9], (const upb_def*)(&msgs[11]), 20, 4, {0},&reftables[182], &reftables[183]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 4, &msgs[13], (const upb_def*)(&msgs[14]), 3, 0, {0},&reftables[184], &reftables[185]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[7], (const upb_def*)(&msgs[8]), 3, 0, {0},&reftables[186], &reftables[187]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[16], (const upb_def*)(&msgs[17]), 7, 1, {0},&reftables[188], &reftables[189]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[5], (const upb_def*)(&msgs[6]), 3, 0, {0},&reftables[190], &reftables[191]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[3], (const upb_def*)(&msgs[4]), 7, 1, {0},&reftables[192], &reftables[193]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "output_type", 3, &msgs[13], NULL, 10, 3, {0},&reftables[194], &reftables[195]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "package", 2, &msgs[9], NULL, 25, 7, {0},&reftables[196], &reftables[197]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "packed", 2, &msgs[8], NULL, 7, 2, {0},&reftables[198], &reftables[199]),
@ -131,20 +132,20 @@ static const upb_fielddef fields[105] = {
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "service", 6, &msgs[9], (const upb_def*)(&msgs[16]), 16, 2, {0},&reftables[214], &reftables[215]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "source_code_info", 9, &msgs[9], (const upb_def*)(&msgs[18]), 21, 5, {0},&reftables[216], &reftables[217]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "span", 2, &msgs[19], NULL, 7, 1, {0},&reftables[218], &reftables[219]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[1], NULL, 2, 0, {0},&reftables[220], &reftables[221]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[2], NULL, 2, 0, {0},&reftables[222], &reftables[223]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[2], NULL, 2, 0, {0},&reftables[220], &reftables[221]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[1], NULL, 2, 0, {0},&reftables[222], &reftables[223]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BYTES, 0, false, false, false, false, "string_value", 7, &msgs[20], NULL, 12, 5, {0},&reftables[224], &reftables[225]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "syntax", 12, &msgs[9], NULL, 39, 11, {0},&reftables[226], &reftables[227]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "trailing_comments", 4, &msgs[19], NULL, 11, 3, {0},&reftables[228], &reftables[229]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "type", 5, &msgs[7], (const upb_def*)(&enums[1]), 12, 5, {0},&reftables[230], &reftables[231]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "type_name", 6, &msgs[7], NULL, 13, 6, {0},&reftables[232], &reftables[233]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[17], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[234], &reftables[235]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[11], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[234], &reftables[235]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[12], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[236], &reftables[237]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[8], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[238], &reftables[239]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[14], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[240], &reftables[241]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[11], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[242], &reftables[243]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[4], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[244], &reftables[245]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[6], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[246], &reftables[247]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[6], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[238], &reftables[239]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[4], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[240], &reftables[241]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[8], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[242], &reftables[243]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[14], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[244], &reftables[245]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[17], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[246], &reftables[247]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "value", 2, &msgs[3], (const upb_def*)(&msgs[5]), 6, 0, {0},&reftables[248], &reftables[249]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "weak", 10, &msgs[8], NULL, 11, 6, {0},&reftables[250], &reftables[251]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "weak_dependency", 11, &msgs[9], NULL, 38, 10, {0},&reftables[252], &reftables[253]),
@ -158,7 +159,7 @@ static const upb_enumdef enums[5] = {
UPB_ENUMDEF_INIT("google.protobuf.FileOptions.OptimizeMode", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[232]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[180], 4, 3), 0, &reftables[262], &reftables[263]),
};
static const upb_tabent strentries[268] = {
static const upb_tabent strentries[236] = {
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "extension"), UPB_TABVALUE_PTR_INIT(&fields[22]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\015", "\000", "\000", "\000", "reserved_name"), UPB_TABVALUE_PTR_INIT(&fields[82]), NULL},
@ -172,50 +173,50 @@ static const upb_tabent strentries[268] = {
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "nested_type"), UPB_TABVALUE_PTR_INIT(&fields[60]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\016", "\000", "\000", "\000", "reserved_range"), UPB_TABVALUE_PTR_INIT(&fields[83]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[70]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[68]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "oneof_decl"), UPB_TABVALUE_PTR_INIT(&fields[65]), NULL},
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "enum_type"), UPB_TABVALUE_PTR_INIT(&fields[20]), &strentries[13]},
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "start"), UPB_TABVALUE_PTR_INIT(&fields[88]), NULL},
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "enum_type"), UPB_TABVALUE_PTR_INIT(&fields[19]), &strentries[13]},
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "start"), UPB_TABVALUE_PTR_INIT(&fields[89]), NULL},
{UPB_TABKEY_STR("\003", "\000", "\000", "\000", "end"), UPB_TABVALUE_PTR_INIT(&fields[18]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "start"), UPB_TABVALUE_PTR_INIT(&fields[89]), NULL},
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "start"), UPB_TABVALUE_PTR_INIT(&fields[88]), NULL},
{UPB_TABKEY_STR("\003", "\000", "\000", "\000", "end"), UPB_TABVALUE_PTR_INIT(&fields[17]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "value"), UPB_TABVALUE_PTR_INIT(&fields[102]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[69]), NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[53]), &strentries[26]},
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[100]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[10]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[74]), NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[49]), &strentries[26]},
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[98]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[13]), NULL},
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "allow_alias"), UPB_TABVALUE_PTR_INIT(&fields[1]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "number"), UPB_TABVALUE_PTR_INIT(&fields[63]), NULL},
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "number"), UPB_TABVALUE_PTR_INIT(&fields[62]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[71]), NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[50]), &strentries[34]},
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[101]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[9]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[73]), NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[53]), &strentries[34]},
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[97]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[15]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "oneof_index"), UPB_TABVALUE_PTR_INIT(&fields[66]), NULL},
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "label"), UPB_TABVALUE_PTR_INIT(&fields[40]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[56]), NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[55]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "number"), UPB_TABVALUE_PTR_INIT(&fields[62]), &strentries[53]},
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "number"), UPB_TABVALUE_PTR_INIT(&fields[63]), &strentries[53]},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\010", "\000", "\000", "\000", "extendee"), UPB_TABVALUE_PTR_INIT(&fields[21]), NULL},
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "type_name"), UPB_TABVALUE_PTR_INIT(&fields[94]), NULL},
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "json_name"), UPB_TABVALUE_PTR_INIT(&fields[38]), NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "type"), UPB_TABVALUE_PTR_INIT(&fields[93]), &strentries[50]},
{UPB_TABKEY_STR("\015", "\000", "\000", "\000", "default_value"), UPB_TABVALUE_PTR_INIT(&fields[7]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[74]), NULL},
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[97]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[71]), NULL},
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[99]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "weak"), UPB_TABVALUE_PTR_INIT(&fields[103]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
@ -228,13 +229,13 @@ static const upb_tabent strentries[268] = {
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "ctype"), UPB_TABVALUE_PTR_INIT(&fields[6]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "jstype"), UPB_TABVALUE_PTR_INIT(&fields[39]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[12]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[10]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "extension"), UPB_TABVALUE_PTR_INIT(&fields[23]), NULL},
{UPB_TABKEY_STR("\017", "\000", "\000", "\000", "weak_dependency"), UPB_TABVALUE_PTR_INIT(&fields[104]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[49]), NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[54]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "service"), UPB_TABVALUE_PTR_INIT(&fields[85]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\020", "\000", "\000", "\000", "source_code_info"), UPB_TABVALUE_PTR_INIT(&fields[86]), NULL},
@ -244,8 +245,8 @@ static const upb_tabent strentries[268] = {
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "dependency"), UPB_TABVALUE_PTR_INIT(&fields[8]), NULL},
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "message_type"), UPB_TABVALUE_PTR_INIT(&fields[47]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "package"), UPB_TABVALUE_PTR_INIT(&fields[76]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[72]), &strentries[86]},
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "enum_type"), UPB_TABVALUE_PTR_INIT(&fields[19]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[69]), &strentries[86]},
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "enum_type"), UPB_TABVALUE_PTR_INIT(&fields[20]), NULL},
{UPB_TABKEY_STR("\021", "\000", "\000", "\000", "public_dependency"), UPB_TABVALUE_PTR_INIT(&fields[80]), &strentries[85]},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "file"), UPB_TABVALUE_PTR_INIT(&fields[26]), NULL},
@ -267,7 +268,7 @@ static const upb_tabent strentries[268] = {
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "java_outer_classname"), UPB_TABVALUE_PTR_INIT(&fields[34]), NULL},
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[99]), NULL},
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[95]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
@ -280,7 +281,7 @@ static const upb_tabent strentries[268] = {
{UPB_TABKEY_STR("\023", "\000", "\000", "\000", "py_generic_services"), UPB_TABVALUE_PTR_INIT(&fields[81]), NULL},
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "optimize_for"), UPB_TABVALUE_PTR_INIT(&fields[67]), NULL},
{UPB_TABKEY_STR("\026", "\000", "\000", "\000", "java_string_check_utf8"), UPB_TABVALUE_PTR_INIT(&fields[36]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[15]), &strentries[119]},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[12]), &strentries[119]},
{UPB_TABKEY_STR("\021", "\000", "\000", "\000", "objc_class_prefix"), UPB_TABVALUE_PTR_INIT(&fields[64]), NULL},
{UPB_TABKEY_STR("\020", "\000", "\000", "\000", "cc_enable_arenas"), UPB_TABVALUE_PTR_INIT(&fields[2]), NULL},
{UPB_TABKEY_STR("\027", "\000", "\000", "\000", "message_set_wire_format"), UPB_TABVALUE_PTR_INIT(&fields[46]), &strentries[128]},
@ -288,31 +289,31 @@ static const upb_tabent strentries[268] = {
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[96]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[14]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[9]), NULL},
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "map_entry"), UPB_TABVALUE_PTR_INIT(&fields[45]), NULL},
{UPB_TABKEY_STR("\037", "\000", "\000", "\000", "no_standard_descriptor_accessor"), UPB_TABVALUE_PTR_INIT(&fields[61]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\020", "\000", "\000", "\000", "client_streaming"), UPB_TABVALUE_PTR_INIT(&fields[4]), NULL},
{UPB_TABKEY_STR("\020", "\000", "\000", "\000", "server_streaming"), UPB_TABVALUE_PTR_INIT(&fields[84]), NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[51]), NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[56]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "input_type"), UPB_TABVALUE_PTR_INIT(&fields[29]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "output_type"), UPB_TABVALUE_PTR_INIT(&fields[75]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[68]), NULL},
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[98]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[13]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[70]), NULL},
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[100]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[11]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[54]), NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[50]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[73]), &strentries[150]},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[72]), &strentries[150]},
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "method"), UPB_TABVALUE_PTR_INIT(&fields[48]), NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[55]), &strentries[149]},
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[95]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[11]), NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[57]), &strentries[149]},
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[101]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[14]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
@ -330,7 +331,7 @@ static const upb_tabent strentries[268] = {
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "double_value"), UPB_TABVALUE_PTR_INIT(&fields[16]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[57]), NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[51]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
@ -395,59 +396,27 @@ static const upb_tabent strentries[268] = {
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "SPEED"), UPB_TABVALUE_INT_INIT(1), &strentries[235]},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "LITE_RUNTIME"), UPB_TABVALUE_INT_INIT(3), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\047", "\000", "\000", "\000", "google.protobuf.SourceCodeInfo.Location"), UPB_TABVALUE_PTR_INIT(&msgs[19]), NULL},
{UPB_TABKEY_STR("\043", "\000", "\000", "\000", "google.protobuf.UninterpretedOption"), UPB_TABVALUE_PTR_INIT(&msgs[20]), NULL},
{UPB_TABKEY_STR("\043", "\000", "\000", "\000", "google.protobuf.FileDescriptorProto"), UPB_TABVALUE_PTR_INIT(&msgs[9]), NULL},
{UPB_TABKEY_STR("\045", "\000", "\000", "\000", "google.protobuf.MethodDescriptorProto"), UPB_TABVALUE_PTR_INIT(&msgs[13]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\040", "\000", "\000", "\000", "google.protobuf.EnumValueOptions"), UPB_TABVALUE_PTR_INIT(&msgs[6]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\055", "\000", "\000", "\000", "google.protobuf.DescriptorProto.ReservedRange"), UPB_TABVALUE_PTR_INIT(&msgs[2]), NULL},
{UPB_TABKEY_STR("\037", "\000", "\000", "\000", "google.protobuf.DescriptorProto"), UPB_TABVALUE_PTR_INIT(&msgs[0]), &strentries[248]},
{UPB_TABKEY_STR("\041", "\000", "\000", "\000", "google.protobuf.FileDescriptorSet"), UPB_TABVALUE_PTR_INIT(&msgs[10]), &strentries[267]},
{UPB_TABKEY_STR("\036", "\000", "\000", "\000", "google.protobuf.SourceCodeInfo"), UPB_TABVALUE_PTR_INIT(&msgs[18]), NULL},
{UPB_TABKEY_STR("\051", "\000", "\000", "\000", "google.protobuf.FieldDescriptorProto.Type"), UPB_TABVALUE_PTR_INIT(&enums[1]), NULL},
{UPB_TABKEY_STR("\056", "\000", "\000", "\000", "google.protobuf.DescriptorProto.ExtensionRange"), UPB_TABVALUE_PTR_INIT(&msgs[1]), NULL},
{UPB_TABKEY_STR("\044", "\000", "\000", "\000", "google.protobuf.OneofDescriptorProto"), UPB_TABVALUE_PTR_INIT(&msgs[15]), NULL},
{UPB_TABKEY_STR("\046", "\000", "\000", "\000", "google.protobuf.ServiceDescriptorProto"), UPB_TABVALUE_PTR_INIT(&msgs[16]), NULL},
{UPB_TABKEY_STR("\034", "\000", "\000", "\000", "google.protobuf.FieldOptions"), UPB_TABVALUE_PTR_INIT(&msgs[8]), NULL},
{UPB_TABKEY_STR("\033", "\000", "\000", "\000", "google.protobuf.FileOptions"), UPB_TABVALUE_PTR_INIT(&msgs[11]), NULL},
{UPB_TABKEY_STR("\043", "\000", "\000", "\000", "google.protobuf.EnumDescriptorProto"), UPB_TABVALUE_PTR_INIT(&msgs[3]), &strentries[265]},
{UPB_TABKEY_STR("\052", "\000", "\000", "\000", "google.protobuf.FieldDescriptorProto.Label"), UPB_TABVALUE_PTR_INIT(&enums[0]), NULL},
{UPB_TABKEY_STR("\050", "\000", "\000", "\000", "google.protobuf.FileOptions.OptimizeMode"), UPB_TABVALUE_PTR_INIT(&enums[4]), NULL},
{UPB_TABKEY_STR("\042", "\000", "\000", "\000", "google.protobuf.FieldOptions.CType"), UPB_TABVALUE_PTR_INIT(&enums[2]), &strentries[261]},
{UPB_TABKEY_STR("\043", "\000", "\000", "\000", "google.protobuf.FieldOptions.JSType"), UPB_TABVALUE_PTR_INIT(&enums[3]), NULL},
{UPB_TABKEY_STR("\033", "\000", "\000", "\000", "google.protobuf.EnumOptions"), UPB_TABVALUE_PTR_INIT(&msgs[4]), NULL},
{UPB_TABKEY_STR("\044", "\000", "\000", "\000", "google.protobuf.FieldDescriptorProto"), UPB_TABVALUE_PTR_INIT(&msgs[7]), NULL},
{UPB_TABKEY_STR("\050", "\000", "\000", "\000", "google.protobuf.EnumValueDescriptorProto"), UPB_TABVALUE_PTR_INIT(&msgs[5]), &strentries[258]},
{UPB_TABKEY_STR("\036", "\000", "\000", "\000", "google.protobuf.ServiceOptions"), UPB_TABVALUE_PTR_INIT(&msgs[17]), NULL},
{UPB_TABKEY_STR("\036", "\000", "\000", "\000", "google.protobuf.MessageOptions"), UPB_TABVALUE_PTR_INIT(&msgs[12]), NULL},
{UPB_TABKEY_STR("\035", "\000", "\000", "\000", "google.protobuf.MethodOptions"), UPB_TABVALUE_PTR_INIT(&msgs[14]), &strentries[253]},
{UPB_TABKEY_STR("\054", "\000", "\000", "\000", "google.protobuf.UninterpretedOption.NamePart"), UPB_TABVALUE_PTR_INIT(&msgs[21]), NULL},
};
static const upb_tabent intentries[18] = {
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[100]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[101]), NULL},
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[98]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[97]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[99]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[95]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[96]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NUM(33), UPB_TABVALUE_PTR_INIT(&fields[13]), NULL},
{UPB_TABKEY_NUM(33), UPB_TABVALUE_PTR_INIT(&fields[11]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[98]), NULL},
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[100]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NUM(33), UPB_TABVALUE_PTR_INIT(&fields[11]), NULL},
{UPB_TABKEY_NUM(33), UPB_TABVALUE_PTR_INIT(&fields[14]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[95]), NULL},
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[101]), NULL},
};
static const upb_tabval arrays[184] = {
@ -455,48 +424,48 @@ static const upb_tabval arrays[184] = {
UPB_TABVALUE_PTR_INIT(&fields[52]),
UPB_TABVALUE_PTR_INIT(&fields[25]),
UPB_TABVALUE_PTR_INIT(&fields[60]),
UPB_TABVALUE_PTR_INIT(&fields[20]),
UPB_TABVALUE_PTR_INIT(&fields[19]),
UPB_TABVALUE_PTR_INIT(&fields[24]),
UPB_TABVALUE_PTR_INIT(&fields[22]),
UPB_TABVALUE_PTR_INIT(&fields[70]),
UPB_TABVALUE_PTR_INIT(&fields[68]),
UPB_TABVALUE_PTR_INIT(&fields[65]),
UPB_TABVALUE_PTR_INIT(&fields[83]),
UPB_TABVALUE_PTR_INIT(&fields[82]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[88]),
UPB_TABVALUE_PTR_INIT(&fields[89]),
UPB_TABVALUE_PTR_INIT(&fields[18]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[89]),
UPB_TABVALUE_PTR_INIT(&fields[88]),
UPB_TABVALUE_PTR_INIT(&fields[17]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[53]),
UPB_TABVALUE_PTR_INIT(&fields[49]),
UPB_TABVALUE_PTR_INIT(&fields[102]),
UPB_TABVALUE_PTR_INIT(&fields[69]),
UPB_TABVALUE_PTR_INIT(&fields[74]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[1]),
UPB_TABVALUE_PTR_INIT(&fields[10]),
UPB_TABVALUE_PTR_INIT(&fields[13]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[50]),
UPB_TABVALUE_PTR_INIT(&fields[63]),
UPB_TABVALUE_PTR_INIT(&fields[71]),
UPB_TABVALUE_PTR_INIT(&fields[53]),
UPB_TABVALUE_PTR_INIT(&fields[62]),
UPB_TABVALUE_PTR_INIT(&fields[73]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[9]),
UPB_TABVALUE_PTR_INIT(&fields[15]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[56]),
UPB_TABVALUE_PTR_INIT(&fields[55]),
UPB_TABVALUE_PTR_INIT(&fields[21]),
UPB_TABVALUE_PTR_INIT(&fields[62]),
UPB_TABVALUE_PTR_INIT(&fields[63]),
UPB_TABVALUE_PTR_INIT(&fields[40]),
UPB_TABVALUE_PTR_INIT(&fields[93]),
UPB_TABVALUE_PTR_INIT(&fields[94]),
UPB_TABVALUE_PTR_INIT(&fields[7]),
UPB_TABVALUE_PTR_INIT(&fields[74]),
UPB_TABVALUE_PTR_INIT(&fields[71]),
UPB_TABVALUE_PTR_INIT(&fields[66]),
UPB_TABVALUE_PTR_INIT(&fields[38]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[6]),
UPB_TABVALUE_PTR_INIT(&fields[77]),
UPB_TABVALUE_PTR_INIT(&fields[12]),
UPB_TABVALUE_PTR_INIT(&fields[10]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[41]),
UPB_TABVALUE_PTR_INIT(&fields[39]),
@ -505,14 +474,14 @@ static const upb_tabval arrays[184] = {
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[103]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[49]),
UPB_TABVALUE_PTR_INIT(&fields[54]),
UPB_TABVALUE_PTR_INIT(&fields[76]),
UPB_TABVALUE_PTR_INIT(&fields[8]),
UPB_TABVALUE_PTR_INIT(&fields[47]),
UPB_TABVALUE_PTR_INIT(&fields[19]),
UPB_TABVALUE_PTR_INIT(&fields[20]),
UPB_TABVALUE_PTR_INIT(&fields[85]),
UPB_TABVALUE_PTR_INIT(&fields[23]),
UPB_TABVALUE_PTR_INIT(&fields[72]),
UPB_TABVALUE_PTR_INIT(&fields[69]),
UPB_TABVALUE_PTR_INIT(&fields[86]),
UPB_TABVALUE_PTR_INIT(&fields[80]),
UPB_TABVALUE_PTR_INIT(&fields[104]),
@ -542,7 +511,7 @@ static const upb_tabval arrays[184] = {
UPB_TABVALUE_PTR_INIT(&fields[31]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[15]),
UPB_TABVALUE_PTR_INIT(&fields[12]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
@ -561,25 +530,25 @@ static const upb_tabval arrays[184] = {
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[46]),
UPB_TABVALUE_PTR_INIT(&fields[61]),
UPB_TABVALUE_PTR_INIT(&fields[14]),
UPB_TABVALUE_PTR_INIT(&fields[9]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[45]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[51]),
UPB_TABVALUE_PTR_INIT(&fields[56]),
UPB_TABVALUE_PTR_INIT(&fields[29]),
UPB_TABVALUE_PTR_INIT(&fields[75]),
UPB_TABVALUE_PTR_INIT(&fields[68]),
UPB_TABVALUE_PTR_INIT(&fields[70]),
UPB_TABVALUE_PTR_INIT(&fields[4]),
UPB_TABVALUE_PTR_INIT(&fields[84]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[54]),
UPB_TABVALUE_PTR_INIT(&fields[50]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[55]),
UPB_TABVALUE_PTR_INIT(&fields[57]),
UPB_TABVALUE_PTR_INIT(&fields[48]),
UPB_TABVALUE_PTR_INIT(&fields[73]),
UPB_TABVALUE_PTR_INIT(&fields[72]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[44]),
@ -592,7 +561,7 @@ static const upb_tabval arrays[184] = {
UPB_TABVALUE_PTR_INIT(&fields[43]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[57]),
UPB_TABVALUE_PTR_INIT(&fields[51]),
UPB_TABVALUE_PTR_INIT(&fields[28]),
UPB_TABVALUE_PTR_INIT(&fields[79]),
UPB_TABVALUE_PTR_INIT(&fields[59]),
@ -637,17 +606,8 @@ static const upb_tabval arrays[184] = {
UPB_TABVALUE_PTR_INIT("LITE_RUNTIME"),
};
static const upb_symtab symtab = UPB_SYMTAB_INIT(UPB_STRTABLE_INIT(27, 31, UPB_CTYPE_PTR, 5, &strentries[236]), &reftables[264], &reftables[265]);
const upb_symtab *upbdefs_google_protobuf_descriptor(const void *owner) {
upb_symtab_ref(&symtab, owner);
return &symtab;
}
#ifdef UPB_DEBUG_REFS
static upb_inttable reftables[266] = {
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
static upb_inttable reftables[264] = {
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
@ -915,3 +875,42 @@ static upb_inttable reftables[266] = {
};
#endif
static const upb_msgdef *refm(const upb_msgdef *m, const void *owner) {
upb_msgdef_ref(m, owner);
return m;
}
static const upb_enumdef *refe(const upb_enumdef *e, const void *owner) {
upb_enumdef_ref(e, owner);
return e;
}
/* Public API. */
const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_get(const void *owner) { return refm(&msgs[0], owner); }
const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_ExtensionRange_get(const void *owner) { return refm(&msgs[1], owner); }
const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_ReservedRange_get(const void *owner) { return refm(&msgs[2], owner); }
const upb_msgdef *upbdefs_google_protobuf_EnumDescriptorProto_get(const void *owner) { return refm(&msgs[3], owner); }
const upb_msgdef *upbdefs_google_protobuf_EnumOptions_get(const void *owner) { return refm(&msgs[4], owner); }
const upb_msgdef *upbdefs_google_protobuf_EnumValueDescriptorProto_get(const void *owner) { return refm(&msgs[5], owner); }
const upb_msgdef *upbdefs_google_protobuf_EnumValueOptions_get(const void *owner) { return refm(&msgs[6], owner); }
const upb_msgdef *upbdefs_google_protobuf_FieldDescriptorProto_get(const void *owner) { return refm(&msgs[7], owner); }
const upb_msgdef *upbdefs_google_protobuf_FieldOptions_get(const void *owner) { return refm(&msgs[8], owner); }
const upb_msgdef *upbdefs_google_protobuf_FileDescriptorProto_get(const void *owner) { return refm(&msgs[9], owner); }
const upb_msgdef *upbdefs_google_protobuf_FileDescriptorSet_get(const void *owner) { return refm(&msgs[10], owner); }
const upb_msgdef *upbdefs_google_protobuf_FileOptions_get(const void *owner) { return refm(&msgs[11], owner); }
const upb_msgdef *upbdefs_google_protobuf_MessageOptions_get(const void *owner) { return refm(&msgs[12], owner); }
const upb_msgdef *upbdefs_google_protobuf_MethodDescriptorProto_get(const void *owner) { return refm(&msgs[13], owner); }
const upb_msgdef *upbdefs_google_protobuf_MethodOptions_get(const void *owner) { return refm(&msgs[14], owner); }
const upb_msgdef *upbdefs_google_protobuf_OneofDescriptorProto_get(const void *owner) { return refm(&msgs[15], owner); }
const upb_msgdef *upbdefs_google_protobuf_ServiceDescriptorProto_get(const void *owner) { return refm(&msgs[16], owner); }
const upb_msgdef *upbdefs_google_protobuf_ServiceOptions_get(const void *owner) { return refm(&msgs[17], owner); }
const upb_msgdef *upbdefs_google_protobuf_SourceCodeInfo_get(const void *owner) { return refm(&msgs[18], owner); }
const upb_msgdef *upbdefs_google_protobuf_SourceCodeInfo_Location_get(const void *owner) { return refm(&msgs[19], owner); }
const upb_msgdef *upbdefs_google_protobuf_UninterpretedOption_get(const void *owner) { return refm(&msgs[20], owner); }
const upb_msgdef *upbdefs_google_protobuf_UninterpretedOption_NamePart_get(const void *owner) { return refm(&msgs[21], owner); }
const upb_enumdef *upbdefs_google_protobuf_FieldDescriptorProto_Label_get(const void *owner) { return refe(&enums[0], owner); }
const upb_enumdef *upbdefs_google_protobuf_FieldDescriptorProto_Type_get(const void *owner) { return refe(&enums[1], owner); }
const upb_enumdef *upbdefs_google_protobuf_FieldOptions_CType_get(const void *owner) { return refe(&enums[2], owner); }
const upb_enumdef *upbdefs_google_protobuf_FieldOptions_JSType_get(const void *owner) { return refe(&enums[3], owner); }
const upb_enumdef *upbdefs_google_protobuf_FileOptions_OptimizeMode_get(const void *owner) { return refe(&enums[4], owner); }

@ -0,0 +1,649 @@
/* This file contains accessors for a set of compiled-in defs.
* Note that unlike Google's protobuf, it does *not* define
* generated classes or any other kind of data structure for
* actually storing protobufs. It only contains *defs* which
* let you reflect over a protobuf *schema*.
*/
/* This file was generated by upbc (the upb compiler).
* 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_
#include "upb/def.h"
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);
const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_ReservedRange_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_EnumDescriptorProto_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_EnumOptions_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_EnumValueDescriptorProto_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_EnumValueOptions_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_FieldDescriptorProto_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_FieldOptions_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_FileDescriptorProto_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_FileDescriptorSet_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_FileOptions_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_MessageOptions_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_MethodDescriptorProto_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_MethodOptions_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_OneofDescriptorProto_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_ServiceDescriptorProto_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_ServiceOptions_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_SourceCodeInfo_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_SourceCodeInfo_Location_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_UninterpretedOption_get(const void *owner);
const upb_msgdef *upbdefs_google_protobuf_UninterpretedOption_NamePart_get(const void *owner);
/* EnumDefs: call these functions to get a ref to an enumdef. */
const upb_enumdef *upbdefs_google_protobuf_FieldDescriptorProto_Label_get(const void *owner);
const upb_enumdef *upbdefs_google_protobuf_FieldDescriptorProto_Type_get(const void *owner);
const upb_enumdef *upbdefs_google_protobuf_FieldOptions_CType_get(const void *owner);
const upb_enumdef *upbdefs_google_protobuf_FieldOptions_JSType_get(const void *owner);
const upb_enumdef *upbdefs_google_protobuf_FileOptions_OptimizeMode_get(const void *owner);
/* Functions to test whether this message is of a certain type. */
UPB_INLINE bool upbdefs_google_protobuf_DescriptorProto_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.DescriptorProto") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_DescriptorProto_ExtensionRange_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.DescriptorProto.ExtensionRange") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_DescriptorProto_ReservedRange_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.DescriptorProto.ReservedRange") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_EnumDescriptorProto_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.EnumDescriptorProto") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_EnumOptions_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.EnumOptions") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_EnumValueDescriptorProto_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.EnumValueDescriptorProto") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_EnumValueOptions_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.EnumValueOptions") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_FieldDescriptorProto_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.FieldDescriptorProto") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_FieldOptions_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.FieldOptions") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_FileDescriptorProto_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.FileDescriptorProto") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_FileDescriptorSet_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.FileDescriptorSet") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_FileOptions_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.FileOptions") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_MessageOptions_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.MessageOptions") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_MethodDescriptorProto_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.MethodDescriptorProto") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_MethodOptions_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.MethodOptions") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_OneofDescriptorProto_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.OneofDescriptorProto") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_ServiceDescriptorProto_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.ServiceDescriptorProto") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_ServiceOptions_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.ServiceOptions") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_SourceCodeInfo_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.SourceCodeInfo") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_SourceCodeInfo_Location_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.SourceCodeInfo.Location") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_UninterpretedOption_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.UninterpretedOption") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_UninterpretedOption_NamePart_is(const upb_msgdef *m) {
return strcmp(upb_msgdef_fullname(m), "google.protobuf.UninterpretedOption.NamePart") == 0;
}
/* Functions to test whether this enum is of a certain type. */
UPB_INLINE bool upbdefs_google_protobuf_FieldDescriptorProto_Label_is(const upb_enumdef *e) {
return strcmp(upb_enumdef_fullname(e), "google.protobuf.FieldDescriptorProto.Label") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_FieldDescriptorProto_Type_is(const upb_enumdef *e) {
return strcmp(upb_enumdef_fullname(e), "google.protobuf.FieldDescriptorProto.Type") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_FieldOptions_CType_is(const upb_enumdef *e) {
return strcmp(upb_enumdef_fullname(e), "google.protobuf.FieldOptions.CType") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_FieldOptions_JSType_is(const upb_enumdef *e) {
return strcmp(upb_enumdef_fullname(e), "google.protobuf.FieldOptions.JSType") == 0;
}
UPB_INLINE bool upbdefs_google_protobuf_FileOptions_OptimizeMode_is(const upb_enumdef *e) {
return strcmp(upb_enumdef_fullname(e), "google.protobuf.FileOptions.OptimizeMode") == 0;
}
/* Functions to get a fielddef from a msgdef reference. */
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_ExtensionRange_f_end(const upb_msgdef *m) { assert(upbdefs_google_protobuf_DescriptorProto_ExtensionRange_is(m)); return upb_msgdef_itof(m, 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_ExtensionRange_f_start(const upb_msgdef *m) { assert(upbdefs_google_protobuf_DescriptorProto_ExtensionRange_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_ReservedRange_f_end(const upb_msgdef *m) { assert(upbdefs_google_protobuf_DescriptorProto_ReservedRange_is(m)); return upb_msgdef_itof(m, 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_ReservedRange_f_start(const upb_msgdef *m) { assert(upbdefs_google_protobuf_DescriptorProto_ReservedRange_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_enum_type(const upb_msgdef *m) { assert(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 4); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_extension(const upb_msgdef *m) { assert(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 6); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_extension_range(const upb_msgdef *m) { assert(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 5); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_field(const upb_msgdef *m) { assert(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_name(const upb_msgdef *m) { assert(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_nested_type(const upb_msgdef *m) { assert(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_oneof_decl(const upb_msgdef *m) { assert(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 8); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_options(const upb_msgdef *m) { assert(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 7); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_reserved_name(const upb_msgdef *m) { assert(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 10); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_DescriptorProto_f_reserved_range(const upb_msgdef *m) { assert(upbdefs_google_protobuf_DescriptorProto_is(m)); return upb_msgdef_itof(m, 9); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumDescriptorProto_f_name(const upb_msgdef *m) { assert(upbdefs_google_protobuf_EnumDescriptorProto_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumDescriptorProto_f_options(const upb_msgdef *m) { assert(upbdefs_google_protobuf_EnumDescriptorProto_is(m)); return upb_msgdef_itof(m, 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumDescriptorProto_f_value(const upb_msgdef *m) { assert(upbdefs_google_protobuf_EnumDescriptorProto_is(m)); return upb_msgdef_itof(m, 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumOptions_f_allow_alias(const upb_msgdef *m) { assert(upbdefs_google_protobuf_EnumOptions_is(m)); return upb_msgdef_itof(m, 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumOptions_f_deprecated(const upb_msgdef *m) { assert(upbdefs_google_protobuf_EnumOptions_is(m)); return upb_msgdef_itof(m, 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumOptions_f_uninterpreted_option(const upb_msgdef *m) { assert(upbdefs_google_protobuf_EnumOptions_is(m)); return upb_msgdef_itof(m, 999); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumValueDescriptorProto_f_name(const upb_msgdef *m) { assert(upbdefs_google_protobuf_EnumValueDescriptorProto_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumValueDescriptorProto_f_number(const upb_msgdef *m) { assert(upbdefs_google_protobuf_EnumValueDescriptorProto_is(m)); return upb_msgdef_itof(m, 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumValueDescriptorProto_f_options(const upb_msgdef *m) { assert(upbdefs_google_protobuf_EnumValueDescriptorProto_is(m)); return upb_msgdef_itof(m, 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumValueOptions_f_deprecated(const upb_msgdef *m) { assert(upbdefs_google_protobuf_EnumValueOptions_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_EnumValueOptions_f_uninterpreted_option(const upb_msgdef *m) { assert(upbdefs_google_protobuf_EnumValueOptions_is(m)); return upb_msgdef_itof(m, 999); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_default_value(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 7); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_extendee(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_json_name(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 10); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_label(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 4); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_name(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_number(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_oneof_index(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 9); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_options(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 8); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_type(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 5); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldDescriptorProto_f_type_name(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldDescriptorProto_is(m)); return upb_msgdef_itof(m, 6); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_f_ctype(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldOptions_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_f_deprecated(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldOptions_is(m)); return upb_msgdef_itof(m, 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_f_jstype(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldOptions_is(m)); return upb_msgdef_itof(m, 6); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_f_lazy(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldOptions_is(m)); return upb_msgdef_itof(m, 5); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_f_packed(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldOptions_is(m)); return upb_msgdef_itof(m, 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_f_uninterpreted_option(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldOptions_is(m)); return upb_msgdef_itof(m, 999); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FieldOptions_f_weak(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FieldOptions_is(m)); return upb_msgdef_itof(m, 10); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_dependency(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_enum_type(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 5); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_extension(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 7); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_message_type(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 4); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_name(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_options(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 8); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_package(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_public_dependency(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 10); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_service(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 6); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_source_code_info(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 9); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_syntax(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 12); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorProto_f_weak_dependency(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileDescriptorProto_is(m)); return upb_msgdef_itof(m, 11); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileDescriptorSet_f_file(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileDescriptorSet_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_cc_enable_arenas(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 31); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_cc_generic_services(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 16); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_csharp_namespace(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 37); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_deprecated(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 23); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_go_package(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 11); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_java_generate_equals_and_hash(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 20); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_java_generic_services(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 17); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_java_multiple_files(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 10); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_java_outer_classname(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 8); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_java_package(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_java_string_check_utf8(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 27); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_javanano_use_deprecated_package(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 38); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_objc_class_prefix(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 36); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_optimize_for(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 9); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_py_generic_services(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 18); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_uninterpreted_option(const upb_msgdef *m) { assert(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 999); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_f_deprecated(const upb_msgdef *m) { assert(upbdefs_google_protobuf_MessageOptions_is(m)); return upb_msgdef_itof(m, 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_f_map_entry(const upb_msgdef *m) { assert(upbdefs_google_protobuf_MessageOptions_is(m)); return upb_msgdef_itof(m, 7); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_f_message_set_wire_format(const upb_msgdef *m) { assert(upbdefs_google_protobuf_MessageOptions_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_f_no_standard_descriptor_accessor(const upb_msgdef *m) { assert(upbdefs_google_protobuf_MessageOptions_is(m)); return upb_msgdef_itof(m, 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_f_uninterpreted_option(const upb_msgdef *m) { assert(upbdefs_google_protobuf_MessageOptions_is(m)); return upb_msgdef_itof(m, 999); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_f_client_streaming(const upb_msgdef *m) { assert(upbdefs_google_protobuf_MethodDescriptorProto_is(m)); return upb_msgdef_itof(m, 5); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_f_input_type(const upb_msgdef *m) { assert(upbdefs_google_protobuf_MethodDescriptorProto_is(m)); return upb_msgdef_itof(m, 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_f_name(const upb_msgdef *m) { assert(upbdefs_google_protobuf_MethodDescriptorProto_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_f_options(const upb_msgdef *m) { assert(upbdefs_google_protobuf_MethodDescriptorProto_is(m)); return upb_msgdef_itof(m, 4); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_f_output_type(const upb_msgdef *m) { assert(upbdefs_google_protobuf_MethodDescriptorProto_is(m)); return upb_msgdef_itof(m, 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodDescriptorProto_f_server_streaming(const upb_msgdef *m) { assert(upbdefs_google_protobuf_MethodDescriptorProto_is(m)); return upb_msgdef_itof(m, 6); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodOptions_f_deprecated(const upb_msgdef *m) { assert(upbdefs_google_protobuf_MethodOptions_is(m)); return upb_msgdef_itof(m, 33); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MethodOptions_f_uninterpreted_option(const upb_msgdef *m) { assert(upbdefs_google_protobuf_MethodOptions_is(m)); return upb_msgdef_itof(m, 999); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_OneofDescriptorProto_f_name(const upb_msgdef *m) { assert(upbdefs_google_protobuf_OneofDescriptorProto_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_ServiceDescriptorProto_f_method(const upb_msgdef *m) { assert(upbdefs_google_protobuf_ServiceDescriptorProto_is(m)); return upb_msgdef_itof(m, 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_ServiceDescriptorProto_f_name(const upb_msgdef *m) { assert(upbdefs_google_protobuf_ServiceDescriptorProto_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_ServiceDescriptorProto_f_options(const upb_msgdef *m) { assert(upbdefs_google_protobuf_ServiceDescriptorProto_is(m)); return upb_msgdef_itof(m, 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_ServiceOptions_f_deprecated(const upb_msgdef *m) { assert(upbdefs_google_protobuf_ServiceOptions_is(m)); return upb_msgdef_itof(m, 33); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_ServiceOptions_f_uninterpreted_option(const upb_msgdef *m) { assert(upbdefs_google_protobuf_ServiceOptions_is(m)); return upb_msgdef_itof(m, 999); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_Location_f_leading_comments(const upb_msgdef *m) { assert(upbdefs_google_protobuf_SourceCodeInfo_Location_is(m)); return upb_msgdef_itof(m, 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_Location_f_leading_detached_comments(const upb_msgdef *m) { assert(upbdefs_google_protobuf_SourceCodeInfo_Location_is(m)); return upb_msgdef_itof(m, 6); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_Location_f_path(const upb_msgdef *m) { assert(upbdefs_google_protobuf_SourceCodeInfo_Location_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_Location_f_span(const upb_msgdef *m) { assert(upbdefs_google_protobuf_SourceCodeInfo_Location_is(m)); return upb_msgdef_itof(m, 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_Location_f_trailing_comments(const upb_msgdef *m) { assert(upbdefs_google_protobuf_SourceCodeInfo_Location_is(m)); return upb_msgdef_itof(m, 4); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_SourceCodeInfo_f_location(const upb_msgdef *m) { assert(upbdefs_google_protobuf_SourceCodeInfo_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_NamePart_f_is_extension(const upb_msgdef *m) { assert(upbdefs_google_protobuf_UninterpretedOption_NamePart_is(m)); return upb_msgdef_itof(m, 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_NamePart_f_name_part(const upb_msgdef *m) { assert(upbdefs_google_protobuf_UninterpretedOption_NamePart_is(m)); return upb_msgdef_itof(m, 1); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_f_aggregate_value(const upb_msgdef *m) { assert(upbdefs_google_protobuf_UninterpretedOption_is(m)); return upb_msgdef_itof(m, 8); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_f_double_value(const upb_msgdef *m) { assert(upbdefs_google_protobuf_UninterpretedOption_is(m)); return upb_msgdef_itof(m, 6); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_f_identifier_value(const upb_msgdef *m) { assert(upbdefs_google_protobuf_UninterpretedOption_is(m)); return upb_msgdef_itof(m, 3); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_f_name(const upb_msgdef *m) { assert(upbdefs_google_protobuf_UninterpretedOption_is(m)); return upb_msgdef_itof(m, 2); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_f_negative_int_value(const upb_msgdef *m) { assert(upbdefs_google_protobuf_UninterpretedOption_is(m)); return upb_msgdef_itof(m, 5); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_f_positive_int_value(const upb_msgdef *m) { assert(upbdefs_google_protobuf_UninterpretedOption_is(m)); return upb_msgdef_itof(m, 4); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_UninterpretedOption_f_string_value(const upb_msgdef *m) { assert(upbdefs_google_protobuf_UninterpretedOption_is(m)); return upb_msgdef_itof(m, 7); }
UPB_END_EXTERN_C
#ifdef __cplusplus
namespace upbdefs {
namespace google {
namespace protobuf {
class DescriptorProto : public upb::reffed_ptr<const upb::MessageDef> {
public:
DescriptorProto(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_DescriptorProto_is(m));
}
static DescriptorProto get() {
const upb::MessageDef* m = upbdefs_google_protobuf_DescriptorProto_get(&m);
return DescriptorProto(m, &m);
}
class ExtensionRange : public upb::reffed_ptr<const upb::MessageDef> {
public:
ExtensionRange(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_DescriptorProto_ExtensionRange_is(m));
}
static ExtensionRange get() {
const upb::MessageDef* m = upbdefs_google_protobuf_DescriptorProto_ExtensionRange_get(&m);
return ExtensionRange(m, &m);
}
};
class ReservedRange : public upb::reffed_ptr<const upb::MessageDef> {
public:
ReservedRange(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_DescriptorProto_ReservedRange_is(m));
}
static ReservedRange get() {
const upb::MessageDef* m = upbdefs_google_protobuf_DescriptorProto_ReservedRange_get(&m);
return ReservedRange(m, &m);
}
};
};
class EnumDescriptorProto : public upb::reffed_ptr<const upb::MessageDef> {
public:
EnumDescriptorProto(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_EnumDescriptorProto_is(m));
}
static EnumDescriptorProto get() {
const upb::MessageDef* m = upbdefs_google_protobuf_EnumDescriptorProto_get(&m);
return EnumDescriptorProto(m, &m);
}
};
class EnumOptions : public upb::reffed_ptr<const upb::MessageDef> {
public:
EnumOptions(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_EnumOptions_is(m));
}
static EnumOptions get() {
const upb::MessageDef* m = upbdefs_google_protobuf_EnumOptions_get(&m);
return EnumOptions(m, &m);
}
};
class EnumValueDescriptorProto : public upb::reffed_ptr<const upb::MessageDef> {
public:
EnumValueDescriptorProto(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_EnumValueDescriptorProto_is(m));
}
static EnumValueDescriptorProto get() {
const upb::MessageDef* m = upbdefs_google_protobuf_EnumValueDescriptorProto_get(&m);
return EnumValueDescriptorProto(m, &m);
}
};
class EnumValueOptions : public upb::reffed_ptr<const upb::MessageDef> {
public:
EnumValueOptions(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_EnumValueOptions_is(m));
}
static EnumValueOptions get() {
const upb::MessageDef* m = upbdefs_google_protobuf_EnumValueOptions_get(&m);
return EnumValueOptions(m, &m);
}
};
class FieldDescriptorProto : public upb::reffed_ptr<const upb::MessageDef> {
public:
FieldDescriptorProto(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_FieldDescriptorProto_is(m));
}
static FieldDescriptorProto get() {
const upb::MessageDef* m = upbdefs_google_protobuf_FieldDescriptorProto_get(&m);
return FieldDescriptorProto(m, &m);
}
class Label : public upb::reffed_ptr<const upb::EnumDef> {
public:
Label(const upb::EnumDef* e, const void *ref_donor = NULL)
: reffed_ptr(e, ref_donor) {
assert(upbdefs_google_protobuf_FieldDescriptorProto_Label_is(e));
}
static Label get() {
const upb::EnumDef* e = upbdefs_google_protobuf_FieldDescriptorProto_Label_get(&e);
return Label(e, &e);
}
};
class Type : public upb::reffed_ptr<const upb::EnumDef> {
public:
Type(const upb::EnumDef* e, const void *ref_donor = NULL)
: reffed_ptr(e, ref_donor) {
assert(upbdefs_google_protobuf_FieldDescriptorProto_Type_is(e));
}
static Type get() {
const upb::EnumDef* e = upbdefs_google_protobuf_FieldDescriptorProto_Type_get(&e);
return Type(e, &e);
}
};
};
class FieldOptions : public upb::reffed_ptr<const upb::MessageDef> {
public:
FieldOptions(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_FieldOptions_is(m));
}
static FieldOptions get() {
const upb::MessageDef* m = upbdefs_google_protobuf_FieldOptions_get(&m);
return FieldOptions(m, &m);
}
class CType : public upb::reffed_ptr<const upb::EnumDef> {
public:
CType(const upb::EnumDef* e, const void *ref_donor = NULL)
: reffed_ptr(e, ref_donor) {
assert(upbdefs_google_protobuf_FieldOptions_CType_is(e));
}
static CType get() {
const upb::EnumDef* e = upbdefs_google_protobuf_FieldOptions_CType_get(&e);
return CType(e, &e);
}
};
class JSType : public upb::reffed_ptr<const upb::EnumDef> {
public:
JSType(const upb::EnumDef* e, const void *ref_donor = NULL)
: reffed_ptr(e, ref_donor) {
assert(upbdefs_google_protobuf_FieldOptions_JSType_is(e));
}
static JSType get() {
const upb::EnumDef* e = upbdefs_google_protobuf_FieldOptions_JSType_get(&e);
return JSType(e, &e);
}
};
};
class FileDescriptorProto : public upb::reffed_ptr<const upb::MessageDef> {
public:
FileDescriptorProto(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_FileDescriptorProto_is(m));
}
static FileDescriptorProto get() {
const upb::MessageDef* m = upbdefs_google_protobuf_FileDescriptorProto_get(&m);
return FileDescriptorProto(m, &m);
}
};
class FileDescriptorSet : public upb::reffed_ptr<const upb::MessageDef> {
public:
FileDescriptorSet(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_FileDescriptorSet_is(m));
}
static FileDescriptorSet get() {
const upb::MessageDef* m = upbdefs_google_protobuf_FileDescriptorSet_get(&m);
return FileDescriptorSet(m, &m);
}
};
class FileOptions : public upb::reffed_ptr<const upb::MessageDef> {
public:
FileOptions(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_FileOptions_is(m));
}
static FileOptions get() {
const upb::MessageDef* m = upbdefs_google_protobuf_FileOptions_get(&m);
return FileOptions(m, &m);
}
class OptimizeMode : public upb::reffed_ptr<const upb::EnumDef> {
public:
OptimizeMode(const upb::EnumDef* e, const void *ref_donor = NULL)
: reffed_ptr(e, ref_donor) {
assert(upbdefs_google_protobuf_FileOptions_OptimizeMode_is(e));
}
static OptimizeMode get() {
const upb::EnumDef* e = upbdefs_google_protobuf_FileOptions_OptimizeMode_get(&e);
return OptimizeMode(e, &e);
}
};
};
class MessageOptions : public upb::reffed_ptr<const upb::MessageDef> {
public:
MessageOptions(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_MessageOptions_is(m));
}
static MessageOptions get() {
const upb::MessageDef* m = upbdefs_google_protobuf_MessageOptions_get(&m);
return MessageOptions(m, &m);
}
};
class MethodDescriptorProto : public upb::reffed_ptr<const upb::MessageDef> {
public:
MethodDescriptorProto(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_MethodDescriptorProto_is(m));
}
static MethodDescriptorProto get() {
const upb::MessageDef* m = upbdefs_google_protobuf_MethodDescriptorProto_get(&m);
return MethodDescriptorProto(m, &m);
}
};
class MethodOptions : public upb::reffed_ptr<const upb::MessageDef> {
public:
MethodOptions(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_MethodOptions_is(m));
}
static MethodOptions get() {
const upb::MessageDef* m = upbdefs_google_protobuf_MethodOptions_get(&m);
return MethodOptions(m, &m);
}
};
class OneofDescriptorProto : public upb::reffed_ptr<const upb::MessageDef> {
public:
OneofDescriptorProto(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_OneofDescriptorProto_is(m));
}
static OneofDescriptorProto get() {
const upb::MessageDef* m = upbdefs_google_protobuf_OneofDescriptorProto_get(&m);
return OneofDescriptorProto(m, &m);
}
};
class ServiceDescriptorProto : public upb::reffed_ptr<const upb::MessageDef> {
public:
ServiceDescriptorProto(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_ServiceDescriptorProto_is(m));
}
static ServiceDescriptorProto get() {
const upb::MessageDef* m = upbdefs_google_protobuf_ServiceDescriptorProto_get(&m);
return ServiceDescriptorProto(m, &m);
}
};
class ServiceOptions : public upb::reffed_ptr<const upb::MessageDef> {
public:
ServiceOptions(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_ServiceOptions_is(m));
}
static ServiceOptions get() {
const upb::MessageDef* m = upbdefs_google_protobuf_ServiceOptions_get(&m);
return ServiceOptions(m, &m);
}
};
class SourceCodeInfo : public upb::reffed_ptr<const upb::MessageDef> {
public:
SourceCodeInfo(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_SourceCodeInfo_is(m));
}
static SourceCodeInfo get() {
const upb::MessageDef* m = upbdefs_google_protobuf_SourceCodeInfo_get(&m);
return SourceCodeInfo(m, &m);
}
class Location : public upb::reffed_ptr<const upb::MessageDef> {
public:
Location(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_SourceCodeInfo_Location_is(m));
}
static Location get() {
const upb::MessageDef* m = upbdefs_google_protobuf_SourceCodeInfo_Location_get(&m);
return Location(m, &m);
}
};
};
class UninterpretedOption : public upb::reffed_ptr<const upb::MessageDef> {
public:
UninterpretedOption(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_UninterpretedOption_is(m));
}
static UninterpretedOption get() {
const upb::MessageDef* m = upbdefs_google_protobuf_UninterpretedOption_get(&m);
return UninterpretedOption(m, &m);
}
class NamePart : public upb::reffed_ptr<const upb::MessageDef> {
public:
NamePart(const upb::MessageDef* m, const void *ref_donor = NULL)
: reffed_ptr(m, ref_donor) {
assert(upbdefs_google_protobuf_UninterpretedOption_NamePart_is(m));
}
static NamePart get() {
const upb::MessageDef* m = upbdefs_google_protobuf_UninterpretedOption_NamePart_get(&m);
return NamePart(m, &m);
}
};
};
} /* namespace protobuf */
} /* namespace google */
} /* namespace upbdefs */
#endif /* __cplusplus */
#endif /* UPB_DESCRIPTOR_DESCRIPTOR_PROTO_UPB_H_ */

@ -13,22 +13,13 @@
#include <string.h>
#include "upb/def.h"
#include "upb/sink.h"
#include "upb/descriptor/descriptor.upb.h"
#include "upb/descriptor/descriptor.upbdefs.h"
/* Compares a NULL-terminated string with a non-NULL-terminated string. */
static bool upb_streq(const char *str, const char *buf, size_t n) {
return strlen(str) == n && memcmp(str, buf, n) == 0;
}
/* upb_deflist is an internal-only dynamic array for storing a growing list of
* upb_defs. */
typedef struct {
upb_def **defs;
size_t len;
size_t size;
bool owned;
} upb_deflist;
/* We keep a stack of all the messages scopes we are currently in, as well as
* the top-level file scope. This is necessary to correctly qualify the
* definitions that are contained inside. "name" tracks the name of the
@ -54,13 +45,11 @@ typedef struct {
struct upb_descreader {
upb_sink sink;
upb_deflist defs;
upb_inttable files;
upb_filedef *file; /* The last file in files. */
upb_descreader_frame stack[UPB_MAX_MESSAGE_NESTING];
int stack_len;
bool primitives_have_presence;
int file_start;
uint32_t number;
char *name;
bool saw_number;
@ -97,53 +86,11 @@ static char *upb_join(const char *base, const char *name) {
}
}
/* upb_deflist ****************************************************************/
void upb_deflist_init(upb_deflist *l) {
l->size = 0;
l->defs = NULL;
l->len = 0;
l->owned = true;
}
void upb_deflist_uninit(upb_deflist *l) {
size_t i;
if (l->owned)
for(i = 0; i < l->len; i++)
upb_def_unref(l->defs[i], l);
free(l->defs);
}
bool upb_deflist_push(upb_deflist *l, upb_def *d) {
if(++l->len >= l->size) {
size_t new_size = UPB_MAX(l->size, 4);
new_size *= 2;
l->defs = realloc(l->defs, new_size * sizeof(void *));
if (!l->defs) return false;
l->size = new_size;
}
l->defs[l->len - 1] = d;
return true;
}
void upb_deflist_donaterefs(upb_deflist *l, void *owner) {
size_t i;
assert(l->owned);
for (i = 0; i < l->len; i++)
upb_def_donateref(l->defs[i], l, owner);
l->owned = false;
}
static upb_def *upb_deflist_last(upb_deflist *l) {
return l->defs[l->len-1];
}
/* Qualify the defname for all defs starting with offset "start" with "str". */
static void upb_deflist_qualify(upb_deflist *l, char *str, int32_t start) {
uint32_t i;
for (i = start; i < l->len; i++) {
upb_def *def = l->defs[i];
static void upb_descreader_qualify(upb_filedef *f, char *str, int32_t start) {
size_t i;
for (i = start; i < upb_filedef_defcount(f); i++) {
upb_def *def = upb_filedef_mutabledef(f, i);
char *name = upb_join(str, upb_def_fullname(def));
upb_def_setfullname(def, name, NULL);
free(name);
@ -158,24 +105,24 @@ static upb_msgdef *upb_descreader_top(upb_descreader *r) {
assert(r->stack_len > 1);
index = r->stack[r->stack_len-1].start - 1;
assert(index >= 0);
return upb_downcast_msgdef_mutable(r->defs.defs[index]);
return upb_downcast_msgdef_mutable(upb_filedef_mutabledef(r->file, index));
}
static upb_def *upb_descreader_last(upb_descreader *r) {
return upb_deflist_last(&r->defs);
return upb_filedef_mutabledef(r->file, upb_filedef_defcount(r->file) - 1);
}
/* Start/end handlers for FileDescriptorProto and DescriptorProto (the two
* entities that have names and can contain sub-definitions. */
void upb_descreader_startcontainer(upb_descreader *r) {
upb_descreader_frame *f = &r->stack[r->stack_len++];
f->start = r->defs.len;
f->start = upb_filedef_defcount(r->file);
f->name = NULL;
}
void upb_descreader_endcontainer(upb_descreader *r) {
upb_descreader_frame *f = &r->stack[--r->stack_len];
upb_deflist_qualify(&r->defs, f->name, f->start);
upb_descreader_qualify(r->file, f->name, f->start);
free(f->name);
f->name = NULL;
}
@ -186,17 +133,26 @@ void upb_descreader_setscopename(upb_descreader *r, char *str) {
f->name = str;
}
/* Handlers for google.protobuf.FileDescriptorProto. */
static bool file_startmsg(void *closure, const void *hd) {
/** Handlers for google.protobuf.FileDescriptorSet. ***************************/
static void *fileset_startfile(void *closure, const void *hd) {
upb_descreader *r = closure;
UPB_UNUSED(hd);
r->file = upb_filedef_new(&r->files);
upb_inttable_push(&r->files, upb_value_ptr(r->file));
return r;
}
/** Handlers for google.protobuf.FileDescriptorProto. *************************/
static bool file_start(void *closure, const void *hd) {
upb_descreader *r = closure;
UPB_UNUSED(hd);
upb_descreader_startcontainer(r);
r->primitives_have_presence = true;
r->file_start = r->defs.len;
return true;
}
static bool file_endmsg(void *closure, const void *hd, upb_status *status) {
static bool file_end(void *closure, const void *hd, upb_status *status) {
upb_descreader *r = closure;
UPB_UNUSED(hd);
UPB_UNUSED(status);
@ -204,46 +160,86 @@ static bool file_endmsg(void *closure, const void *hd, upb_status *status) {
return true;
}
static size_t file_onname(void *closure, const void *hd, const char *buf,
size_t n, const upb_bufhandle *handle) {
upb_descreader *r = closure;
char *name;
bool ok;
UPB_UNUSED(hd);
UPB_UNUSED(handle);
name = upb_strndup(buf, n);
/* XXX: see comment at the top of the file. */
ok = upb_filedef_setname(r->file, name, NULL);
UPB_ASSERT_VAR(ok, ok);
return n;
}
static size_t file_onpackage(void *closure, const void *hd, const char *buf,
size_t n, const upb_bufhandle *handle) {
upb_descreader *r = closure;
char *package;
bool ok;
UPB_UNUSED(hd);
UPB_UNUSED(handle);
package = upb_strndup(buf, n);
/* XXX: see comment at the top of the file. */
upb_descreader_setscopename(r, upb_strndup(buf, n));
upb_descreader_setscopename(r, package);
ok = upb_filedef_setpackage(r->file, package, NULL);
UPB_ASSERT_VAR(ok, ok);
return n;
}
static size_t file_onsyntax(void *closure, const void *hd, const char *buf,
size_t n, const upb_bufhandle *handle) {
upb_descreader *r = closure;
bool ok;
UPB_UNUSED(hd);
UPB_UNUSED(handle);
/* XXX: see comment at the top of the file. */
if (upb_streq("proto2", buf, n)) {
/* Technically we could verify that proto3 hadn't previously been seen. */
ok = upb_filedef_setsyntax(r->file, UPB_SYNTAX_PROTO2, NULL);
} else if (upb_streq("proto3", buf, n)) {
uint32_t i;
/* Update messages created before the syntax was read. */
for (i = r->file_start; i < r->defs.len; i++) {
upb_msgdef *m = upb_dyncast_msgdef_mutable(r->defs.defs[i]);
if (m) {
upb_msgdef_setprimitiveshavepresence(m, false);
}
}
/* Set a flag for any future messages that will be created. */
r->primitives_have_presence = false;
ok = upb_filedef_setsyntax(r->file, UPB_SYNTAX_PROTO3, NULL);
} else {
/* Error: neither proto3 nor proto3.
* TODO(haberman): there should be a status object we can report this to. */
return 0;
ok = false;
}
UPB_ASSERT_VAR(ok, ok);
return n;
}
/* Handlers for google.protobuf.EnumValueDescriptorProto. */
static void *file_startmsg(void *closure, const void *hd) {
upb_descreader *r = closure;
upb_msgdef *m = upb_msgdef_new(&m);
bool ok = upb_filedef_addmsg(r->file, m, &m, NULL);
UPB_UNUSED(hd);
UPB_ASSERT_VAR(ok, ok);
return r;
}
static void *file_startenum(void *closure, const void *hd) {
upb_descreader *r = closure;
upb_enumdef *e = upb_enumdef_new(&e);
bool ok = upb_filedef_addenum(r->file, e, &e, NULL);
UPB_UNUSED(hd);
UPB_ASSERT_VAR(ok, ok);
return r;
}
static void *file_startext(void *closure, const void *hd) {
upb_descreader *r = closure;
bool ok;
r->f = upb_fielddef_new(r);
ok = upb_filedef_addext(r->file, r->f, r, NULL);
UPB_UNUSED(hd);
UPB_ASSERT_VAR(ok, ok);
return r;
}
/** Handlers for google.protobuf.EnumValueDescriptorProto. *********************/
static bool enumval_startmsg(void *closure, const void *hd) {
upb_descreader *r = closure;
UPB_UNUSED(hd);
@ -288,15 +284,7 @@ static bool enumval_endmsg(void *closure, const void *hd, upb_status *status) {
return true;
}
/* Handlers for google.protobuf.EnumDescriptorProto. */
static bool enum_startmsg(void *closure, const void *hd) {
upb_descreader *r = closure;
UPB_UNUSED(hd);
upb_deflist_push(&r->defs,
upb_enumdef_upcast_mutable(upb_enumdef_new(&r->defs)));
return true;
}
/** Handlers for google.protobuf.EnumDescriptorProto. *************************/
static bool enum_endmsg(void *closure, const void *hd, upb_status *status) {
upb_descreader *r = closure;
@ -327,11 +315,12 @@ static size_t enum_onname(void *closure, const void *hd, const char *buf,
return n;
}
/* Handlers for google.protobuf.FieldDescriptorProto */
/** Handlers for google.protobuf.FieldDescriptorProto *************************/
static bool field_startmsg(void *closure, const void *hd) {
upb_descreader *r = closure;
UPB_UNUSED(hd);
r->f = upb_fielddef_new(&r->defs);
assert(r->f);
free(r->default_string);
r->default_string = NULL;
@ -474,9 +463,10 @@ static bool field_onlabel(void *closure, const void *hd, int32_t val) {
static bool field_onnumber(void *closure, const void *hd, int32_t val) {
upb_descreader *r = closure;
bool ok = upb_fielddef_setnumber(r->f, val, NULL);
bool ok;
UPB_UNUSED(hd);
ok = upb_fielddef_setnumber(r->f, val, NULL);
UPB_ASSERT_VAR(ok, ok);
return true;
}
@ -534,20 +524,17 @@ static size_t field_ondefaultval(void *closure, const void *hd, const char *buf,
return n;
}
/* Handlers for google.protobuf.DescriptorProto (representing a message). */
static bool msg_startmsg(void *closure, const void *hd) {
/** Handlers for google.protobuf.DescriptorProto ******************************/
static bool msg_start(void *closure, const void *hd) {
upb_descreader *r = closure;
upb_msgdef *m;
UPB_UNUSED(hd);
m = upb_msgdef_new(&r->defs);
upb_msgdef_setprimitiveshavepresence(m, r->primitives_have_presence);
upb_deflist_push(&r->defs, upb_msgdef_upcast_mutable(m));
upb_descreader_startcontainer(r);
return true;
}
static bool msg_endmsg(void *closure, const void *hd, upb_status *status) {
static bool msg_end(void *closure, const void *hd, upb_status *status) {
upb_descreader *r = closure;
upb_msgdef *m = upb_descreader_top(r);
UPB_UNUSED(hd);
@ -560,8 +547,8 @@ static bool msg_endmsg(void *closure, const void *hd, upb_status *status) {
return true;
}
static size_t msg_onname(void *closure, const void *hd, const char *buf,
size_t n, const upb_bufhandle *handle) {
static size_t msg_name(void *closure, const void *hd, const char *buf,
size_t n, const upb_bufhandle *handle) {
upb_descreader *r = closure;
upb_msgdef *m = upb_descreader_top(r);
/* XXX: see comment at the top of the file. */
@ -574,89 +561,130 @@ static size_t msg_onname(void *closure, const void *hd, const char *buf,
return n;
}
static bool msg_onendfield(void *closure, const void *hd) {
static void *msg_startmsg(void *closure, const void *hd) {
upb_descreader *r = closure;
upb_msgdef *m = upb_descreader_top(r);
upb_msgdef *m = upb_msgdef_new(&m);
bool ok = upb_filedef_addmsg(r->file, m, &m, NULL);
UPB_UNUSED(hd);
UPB_ASSERT_VAR(ok, ok);
return r;
}
upb_msgdef_addfield(m, r->f, &r->defs, NULL);
r->f = NULL;
return true;
static void *msg_startext(void *closure, const void *hd) {
upb_descreader *r = closure;
upb_fielddef *f = upb_fielddef_new(&f);
bool ok = upb_filedef_addext(r->file, f, &f, NULL);
UPB_UNUSED(hd);
UPB_ASSERT_VAR(ok, ok);
return r;
}
static void *msg_startfield(void *closure, const void *hd) {
upb_descreader *r = closure;
r->f = upb_fielddef_new(&r->f);
/* We can't add the new field to the message until its name/number are
* filled in. */
UPB_UNUSED(hd);
return r;
}
static bool pushextension(void *closure, const void *hd) {
static bool msg_endfield(void *closure, const void *hd) {
upb_descreader *r = closure;
upb_msgdef *m = upb_descreader_top(r);
UPB_UNUSED(hd);
assert(upb_fielddef_containingtypename(r->f));
upb_fielddef_setisextension(r->f, true);
upb_deflist_push(&r->defs, upb_fielddef_upcast_mutable(r->f));
upb_msgdef_addfield(m, r->f, &r->f, NULL);
r->f = NULL;
return true;
}
#define D(name) upbdefs_google_protobuf_ ## name(s)
/** Code to register handlers *************************************************/
#define F(msg, field) upbdefs_google_protobuf_ ## msg ## _f_ ## field(m)
static void reghandlers(const void *closure, upb_handlers *h) {
const upb_symtab *s = closure;
const upb_msgdef *m = upb_handlers_msgdef(h);
if (m == D(DescriptorProto)) {
upb_handlers_setstartmsg(h, &msg_startmsg, NULL);
upb_handlers_setendmsg(h, &msg_endmsg, NULL);
upb_handlers_setstring(h, D(DescriptorProto_name), &msg_onname, NULL);
upb_handlers_setendsubmsg(h, D(DescriptorProto_field), &msg_onendfield,
NULL);
upb_handlers_setendsubmsg(h, D(DescriptorProto_extension), &pushextension,
NULL);
} else if (m == D(FileDescriptorProto)) {
upb_handlers_setstartmsg(h, &file_startmsg, NULL);
upb_handlers_setendmsg(h, &file_endmsg, NULL);
upb_handlers_setstring(h, D(FileDescriptorProto_package), &file_onpackage,
UPB_UNUSED(closure);
if (upbdefs_google_protobuf_FileDescriptorSet_is(m)) {
upb_handlers_setstartsubmsg(h, F(FileDescriptorSet, file),
&fileset_startfile, NULL);
} else if (upbdefs_google_protobuf_DescriptorProto_is(m)) {
upb_handlers_setstartmsg(h, &msg_start, NULL);
upb_handlers_setendmsg(h, &msg_end, NULL);
upb_handlers_setstring(h, F(DescriptorProto, name), &msg_name, NULL);
upb_handlers_setstartsubmsg(h, F(DescriptorProto, extension), &msg_startext,
NULL);
upb_handlers_setstartsubmsg(h, F(DescriptorProto, nested_type),
&msg_startmsg, NULL);
upb_handlers_setstartsubmsg(h, F(DescriptorProto, field),
&msg_startfield, NULL);
upb_handlers_setendsubmsg(h, F(DescriptorProto, field),
&msg_endfield, NULL);
upb_handlers_setstartsubmsg(h, F(DescriptorProto, enum_type),
&file_startenum, NULL);
} else if (upbdefs_google_protobuf_FileDescriptorProto_is(m)) {
upb_handlers_setstartmsg(h, &file_start, NULL);
upb_handlers_setendmsg(h, &file_end, NULL);
upb_handlers_setstring(h, F(FileDescriptorProto, name), &file_onname,
NULL);
upb_handlers_setstring(h, F(FileDescriptorProto, package), &file_onpackage,
NULL);
upb_handlers_setstring(h, D(FileDescriptorProto_syntax), &file_onsyntax,
upb_handlers_setstring(h, F(FileDescriptorProto, syntax), &file_onsyntax,
NULL);
upb_handlers_setendsubmsg(h, D(FileDescriptorProto_extension), &pushextension,
NULL);
} else if (m == D(EnumValueDescriptorProto)) {
upb_handlers_setstartsubmsg(h, F(FileDescriptorProto, message_type),
&file_startmsg, NULL);
upb_handlers_setstartsubmsg(h, F(FileDescriptorProto, enum_type),
&file_startenum, NULL);
upb_handlers_setstartsubmsg(h, F(FileDescriptorProto, extension),
&file_startext, NULL);
} else if (upbdefs_google_protobuf_EnumValueDescriptorProto_is(m)) {
upb_handlers_setstartmsg(h, &enumval_startmsg, NULL);
upb_handlers_setendmsg(h, &enumval_endmsg, NULL);
upb_handlers_setstring(h, D(EnumValueDescriptorProto_name), &enumval_onname, NULL);
upb_handlers_setint32(h, D(EnumValueDescriptorProto_number), &enumval_onnumber,
upb_handlers_setstring(h, F(EnumValueDescriptorProto, name), &enumval_onname, NULL);
upb_handlers_setint32(h, F(EnumValueDescriptorProto, number), &enumval_onnumber,
NULL);
} else if (m == D(EnumDescriptorProto)) {
upb_handlers_setstartmsg(h, &enum_startmsg, NULL);
} else if (upbdefs_google_protobuf_EnumDescriptorProto_is(m)) {
upb_handlers_setendmsg(h, &enum_endmsg, NULL);
upb_handlers_setstring(h, D(EnumDescriptorProto_name), &enum_onname, NULL);
} else if (m == D(FieldDescriptorProto)) {
upb_handlers_setstring(h, F(EnumDescriptorProto, name), &enum_onname, NULL);
} else if (upbdefs_google_protobuf_FieldDescriptorProto_is(m)) {
upb_handlers_setstartmsg(h, &field_startmsg, NULL);
upb_handlers_setendmsg(h, &field_endmsg, NULL);
upb_handlers_setint32(h, D(FieldDescriptorProto_type), &field_ontype,
upb_handlers_setint32(h, F(FieldDescriptorProto, type), &field_ontype,
NULL);
upb_handlers_setint32(h, D(FieldDescriptorProto_label), &field_onlabel,
upb_handlers_setint32(h, F(FieldDescriptorProto, label), &field_onlabel,
NULL);
upb_handlers_setint32(h, D(FieldDescriptorProto_number), &field_onnumber,
upb_handlers_setint32(h, F(FieldDescriptorProto, number), &field_onnumber,
NULL);
upb_handlers_setstring(h, D(FieldDescriptorProto_name), &field_onname,
upb_handlers_setstring(h, F(FieldDescriptorProto, name), &field_onname,
NULL);
upb_handlers_setstring(h, D(FieldDescriptorProto_type_name),
upb_handlers_setstring(h, F(FieldDescriptorProto, type_name),
&field_ontypename, NULL);
upb_handlers_setstring(h, D(FieldDescriptorProto_extendee),
upb_handlers_setstring(h, F(FieldDescriptorProto, extendee),
&field_onextendee, NULL);
upb_handlers_setstring(h, D(FieldDescriptorProto_default_value),
upb_handlers_setstring(h, F(FieldDescriptorProto, default_value),
&field_ondefaultval, NULL);
} else if (m == D(FieldOptions)) {
upb_handlers_setbool(h, D(FieldOptions_lazy), &field_onlazy, NULL);
upb_handlers_setbool(h, D(FieldOptions_packed), &field_onpacked, NULL);
} else if (upbdefs_google_protobuf_FieldOptions_is(m)) {
upb_handlers_setbool(h, F(FieldOptions, lazy), &field_onlazy, NULL);
upb_handlers_setbool(h, F(FieldOptions, packed), &field_onpacked, NULL);
}
assert(upb_ok(upb_handlers_status(h)));
}
#undef D
#undef F
void descreader_cleanup(void *_r) {
upb_descreader *r = _r;
size_t i;
for (i = 0; i < upb_descreader_filecount(r); i++) {
upb_filedef_unref(upb_descreader_file(r, i), &r->files);
}
free(r->name);
upb_deflist_uninit(&r->defs);
upb_inttable_uninit(&r->files);
free(r->default_string);
while (r->stack_len > 0) {
upb_descreader_frame *f = &r->stack[--r->stack_len];
@ -673,7 +701,7 @@ upb_descreader *upb_descreader_create(upb_env *e, const upb_handlers *h) {
return NULL;
}
upb_deflist_init(&r->defs);
upb_inttable_init(&r->files, UPB_CTYPE_PTR);
upb_sink_reset(upb_descreader_input(r), h, r);
r->stack_len = 0;
r->name = NULL;
@ -682,10 +710,17 @@ upb_descreader *upb_descreader_create(upb_env *e, const upb_handlers *h) {
return r;
}
upb_def **upb_descreader_getdefs(upb_descreader *r, void *owner, int *n) {
*n = r->defs.len;
upb_deflist_donaterefs(&r->defs, owner);
return r->defs.defs;
size_t upb_descreader_filecount(const upb_descreader *r) {
return upb_inttable_count(&r->files);
}
upb_filedef *upb_descreader_file(const upb_descreader *r, size_t i) {
upb_value v;
if (upb_inttable_lookup(&r->files, i, &v)) {
return upb_value_getptr(v);
} else {
return NULL;
}
}
upb_sink *upb_descreader_input(upb_descreader *r) {
@ -693,9 +728,8 @@ upb_sink *upb_descreader_input(upb_descreader *r) {
}
const upb_handlers *upb_descreader_newhandlers(const void *owner) {
const upb_symtab *s = upbdefs_google_protobuf_descriptor(&s);
const upb_handlers *h = upb_handlers_newfrozen(
upbdefs_google_protobuf_FileDescriptorSet(s), owner, reghandlers, s);
upb_symtab_unref(s, &s);
const upb_msgdef *m = upbdefs_google_protobuf_FileDescriptorSet_get(&m);
const upb_handlers *h = upb_handlers_newfrozen(m, owner, reghandlers, NULL);
upb_msgdef_unref(m, &m);
return h;
}

@ -39,14 +39,9 @@ class upb::descriptor::Reader {
/* The reader's input; this is where descriptor.proto data should be sent. */
Sink* input();
/* Returns an array of all defs that have been parsed, and transfers ownership
* of them to "owner". The number of defs is stored in *n. Ownership of the
* returned array is retained and is invalidated by any other call into
* Reader.
*
* These defs are not frozen or resolved; they are ready to be added to a
* symtab. */
upb::Def** GetDefs(void* owner, int* n);
/* Use to get the FileDefs that have been parsed. */
size_t file_count() const;
FileDef* file(size_t i) const;
/* Builds and returns handlers for the reader, owned by "owner." */
static Handlers* NewHandlers(const void* owner);
@ -62,7 +57,8 @@ UPB_BEGIN_EXTERN_C
/* C API. */
upb_descreader *upb_descreader_create(upb_env *e, const upb_handlers *h);
upb_sink *upb_descreader_input(upb_descreader *r);
upb_def **upb_descreader_getdefs(upb_descreader *r, void *owner, int *n);
size_t upb_descreader_filecount(const upb_descreader *r);
upb_filedef *upb_descreader_file(const upb_descreader *r, size_t i);
const upb_handlers *upb_descreader_newhandlers(const void *owner);
UPB_END_EXTERN_C
@ -75,8 +71,11 @@ inline Reader* Reader::Create(Environment* e, const Handlers *h) {
return upb_descreader_create(e, h);
}
inline Sink* Reader::input() { return upb_descreader_input(this); }
inline upb::Def** Reader::GetDefs(void* owner, int* n) {
return upb_descreader_getdefs(this, owner, n);
inline size_t Reader::file_count() const {
return upb_descreader_filecount(this);
}
inline FileDef* Reader::file(size_t i) const {
return upb_descreader_file(this, i);
}
} /* namespace descriptor */
} /* namespace upb */

@ -7,8 +7,8 @@
#include "upb/descriptor/reader.h"
#include "upb/pb/decoder.h"
upb_def **upb_load_defs_from_descriptor(const char *str, size_t len, int *n,
void *owner, upb_status *status) {
upb_filedef **upb_loaddescriptor(const char *buf, size_t n, const void *owner,
upb_status *status) {
/* Create handlers. */
const upb_pbdecodermethod *decoder_m;
const upb_handlers *reader_h = upb_descreader_newhandlers(&reader_h);
@ -17,8 +17,8 @@ upb_def **upb_load_defs_from_descriptor(const char *str, size_t len, int *n,
upb_pbdecoder *decoder;
upb_descreader *reader;
bool ok;
upb_def **ret = NULL;
upb_def **defs;
size_t i;
upb_filedef **ret = NULL;
upb_pbdecodermethodopts_init(&opts, reader_h);
decoder_m = upb_pbdecodermethod_new(&opts, &decoder_m);
@ -30,12 +30,24 @@ upb_def **upb_load_defs_from_descriptor(const char *str, size_t len, int *n,
decoder = upb_pbdecoder_create(&env, decoder_m, upb_descreader_input(reader));
/* Push input data. */
ok = upb_bufsrc_putbuf(str, len, upb_pbdecoder_input(decoder));
ok = upb_bufsrc_putbuf(buf, n, upb_pbdecoder_input(decoder));
if (!ok) goto cleanup;
defs = upb_descreader_getdefs(reader, owner, n);
ret = malloc(sizeof(upb_def*) * (*n));
memcpy(ret, defs, sizeof(upb_def*) * (*n));
if (!ok) {
goto cleanup;
}
ret = malloc(sizeof (*ret) * (upb_descreader_filecount(reader) + 1));
if (!ret) {
goto cleanup;
}
for (i = 0; i < upb_descreader_filecount(reader); i++) {
ret[i] = upb_descreader_file(reader, i);
upb_filedef_ref(ret[i], owner);
}
ret[i] = NULL;
cleanup:
upb_env_uninit(&env);
@ -43,48 +55,3 @@ cleanup:
upb_pbdecodermethod_unref(decoder_m, &decoder_m);
return ret;
}
bool upb_load_descriptor_into_symtab(upb_symtab *s, const char *str, size_t len,
upb_status *status) {
int n;
bool success;
upb_def **defs = upb_load_defs_from_descriptor(str, len, &n, &defs, status);
if (!defs) return false;
success = upb_symtab_add(s, defs, n, &defs, status);
free(defs);
return success;
}
char *upb_readfile(const char *filename, size_t *len) {
long size;
char *buf;
FILE *f = fopen(filename, "rb");
if(!f) return NULL;
if(fseek(f, 0, SEEK_END) != 0) goto error;
size = ftell(f);
if(size < 0) goto error;
if(fseek(f, 0, SEEK_SET) != 0) goto error;
buf = malloc(size + 1);
if(size && fread(buf, size, 1, f) != 1) goto error;
fclose(f);
if (len) *len = size;
return buf;
error:
fclose(f);
return NULL;
}
bool upb_load_descriptor_file_into_symtab(upb_symtab *symtab, const char *fname,
upb_status *status) {
size_t len;
bool success;
char *data = upb_readfile(fname, &len);
if (!data) {
if (status) upb_status_seterrf(status, "Couldn't read file: %s", fname);
return false;
}
success = upb_load_descriptor_into_symtab(symtab, data, len, status);
free(data);
return success;
}

@ -25,49 +25,43 @@
#include "upb/symtab.h"
#ifdef __cplusplus
#include <vector>
extern "C" {
#endif
/* Loads all defs from the given protobuf binary descriptor, setting default
* accessors and a default layout on all messages. The caller owns the
* returned array of defs, which will be of length *n. On error NULL is
* returned and status is set (if non-NULL). */
upb_def **upb_load_defs_from_descriptor(const char *str, size_t len, int *n,
void *owner, upb_status *status);
/* Like the previous but also adds the loaded defs to the given symtab. */
bool upb_load_descriptor_into_symtab(upb_symtab *symtab, const char *str,
size_t len, upb_status *status);
/* Like the previous but also reads the descriptor from the given filename. */
bool upb_load_descriptor_file_into_symtab(upb_symtab *symtab, const char *fname,
upb_status *status);
/* Reads the given filename into a character string, returning NULL if there
* was an error. */
char *upb_readfile(const char *filename, size_t *len);
/* Loads a binary descriptor and returns a NULL-terminated array of unfrozen
* filedefs. The caller owns the returned array. */
upb_filedef **upb_loaddescriptor(const char *buf, size_t n, const void *owner,
upb_status *status);
#ifdef __cplusplus
} /* extern "C" */
namespace upb {
/* All routines that load descriptors expect the descriptor to be a
* FileDescriptorSet. */
inline bool LoadDescriptorFileIntoSymtab(SymbolTable* s, const char *fname,
Status* status) {
return upb_load_descriptor_file_into_symtab(s, fname, status);
}
inline bool LoadDescriptor(const char* buf, size_t n, Status* status,
std::vector<reffed_ptr<FileDef> >* files) {
FileDef** parsed_files = upb_loaddescriptor(buf, n, &parsed_files, status);
inline bool LoadDescriptorIntoSymtab(SymbolTable* s, const char* str,
size_t len, Status* status) {
return upb_load_descriptor_into_symtab(s, str, len, status);
if (parsed_files) {
FileDef** p = parsed_files;
while (*p) {
files->push_back(reffed_ptr<FileDef>(*p, &parsed_files));
++p;
}
free(parsed_files);
return true;
} else {
return false;
}
}
/* Templated so it can accept both string and std::string. */
template <typename T>
bool LoadDescriptorIntoSymtab(SymbolTable* s, const T& desc, Status* status) {
return upb_load_descriptor_into_symtab(s, desc.c_str(), desc.size(), status);
bool LoadDescriptor(const T& desc, Status* status,
std::vector<reffed_ptr<FileDef> >* files) {
return LoadDescriptor(desc.c_str(), desc.size(), status, files);
}
} /* namespace upb */

@ -838,8 +838,11 @@ void upb_refcounted_checkref(const upb_refcounted *r, const void *owner) {
bool upb_refcounted_freeze(upb_refcounted *const*roots, int n, upb_status *s,
int maxdepth) {
int i;
bool ret;
for (i = 0; i < n; i++) {
assert(!roots[i]->is_frozen);
}
return freeze(roots, n, s, maxdepth);
ret = freeze(roots, n, s, maxdepth);
assert(!s || ret == upb_ok(s));
return ret;
}

@ -33,6 +33,7 @@ struct upb_def {
upb_refcounted base;
const char *fullname;
const upb_filedef* file;
char type; /* A upb_deftype_t (char to save space) */
/* Used as a flag during the def's mutable stage. Must be false unless
@ -43,7 +44,7 @@ struct upb_def {
};
#define UPB_DEF_INIT(name, type, refs, ref2s) \
{ UPB_REFCOUNT_INIT(refs, ref2s), name, type, false }
{ UPB_REFCOUNT_INIT(refs, ref2s), name, NULL, type, false }
/* upb_fielddef ***************************************************************/
@ -114,10 +115,10 @@ struct upb_msgdef {
* descriptor.upb.c. */
bool map_entry;
/* Do primitive values in this message have explicit presence or not?
/* Whether this message has proto2 or proto3 semantics.
* TODO: set this flag properly for static descriptors; regenerate
* descriptor.upb.c. */
bool primitives_have_presence;
upb_syntax_t syntax;
/* TODO(haberman): proper extension ranges (there can be multiple). */
};
@ -173,5 +174,15 @@ struct upb_symtab {
#define UPB_SYMTAB_INIT(symtab, refs, ref2s) \
{ UPB_REFCOUNT_INIT(refs, ref2s), symtab }
struct upb_filedef {
upb_refcounted base;
const char *name;
const char *package;
upb_syntax_t syntax;
upb_inttable defs;
upb_inttable deps;
};
#endif /* UPB_STATICINIT_H_ */

@ -194,11 +194,16 @@ oom:
/* TODO(haberman): we need a lot more testing of error conditions.
* The came_from_user stuff in particular is not tested. */
bool upb_symtab_add(upb_symtab *s, upb_def *const*defs, int n, void *ref_donor,
upb_status *status) {
int i;
static bool symtab_add(upb_symtab *s, upb_def *const*defs, size_t n,
void *ref_donor, upb_refcounted *freeze_also,
upb_status *status) {
size_t i;
size_t add_n;
size_t freeze_n;
upb_strtable_iter iter;
upb_refcounted **add_objs = NULL;
upb_def **add_defs = NULL;
size_t add_objs_size;
upb_strtable addtab;
upb_inttable seen;
@ -343,15 +348,38 @@ bool upb_symtab_add(upb_symtab *s, upb_def *const*defs, int n, void *ref_donor,
}
}
/* We need an array of the defs in addtab, for passing to upb_def_freeze. */
add_defs = malloc(sizeof(void*) * upb_strtable_count(&addtab));
/* We need an array of the defs in addtab, for passing to
* upb_refcounted_freeze(). */
add_objs_size = upb_strtable_count(&addtab);
if (freeze_also) {
add_objs_size++;
}
add_defs = malloc(sizeof(void*) * add_objs_size);
if (add_defs == NULL) goto oom_err;
upb_strtable_begin(&iter, &addtab);
for (n = 0; !upb_strtable_done(&iter); upb_strtable_next(&iter)) {
add_defs[n++] = upb_value_getptr(upb_strtable_iter_value(&iter));
for (add_n = 0; !upb_strtable_done(&iter); upb_strtable_next(&iter)) {
add_defs[add_n++] = upb_value_getptr(upb_strtable_iter_value(&iter));
}
/* Validate defs. */
if (!_upb_def_validate(add_defs, add_n, status)) {
goto err;
}
/* Cheat a little and give the array a new type.
* This is probably undefined behavior, but this code will be deleted soon. */
add_objs = (upb_refcounted**)add_defs;
freeze_n = add_n;
if (freeze_also) {
add_objs[freeze_n++] = freeze_also;
}
if (!upb_def_freeze(add_defs, n, status)) goto err;
if (!upb_refcounted_freeze(add_objs, freeze_n, status,
UPB_MAX_MESSAGE_DEPTH * 2)) {
goto err;
}
/* This must be delayed until all errors have been detected, since error
* recovery code uses this table to cleanup defs. */
@ -359,8 +387,8 @@ bool upb_symtab_add(upb_symtab *s, upb_def *const*defs, int n, void *ref_donor,
/* TODO(haberman) we don't properly handle errors after this point (like
* OOM in upb_strtable_insert() below). */
for (i = 0; i < n; i++) {
upb_def *def = add_defs[i];
for (i = 0; i < add_n; i++) {
upb_def *def = (upb_def*)add_objs[i];
const char *name = upb_def_fullname(def);
upb_value v;
bool success;
@ -372,7 +400,7 @@ bool upb_symtab_add(upb_symtab *s, upb_def *const*defs, int n, void *ref_donor,
success = upb_strtable_insert(&s->symtab, name, upb_value_ptr(def));
UPB_ASSERT_VAR(success, success == true);
}
free(add_defs);
free(add_objs);
return true;
oom_err:
@ -393,11 +421,40 @@ err: {
}
}
upb_strtable_uninit(&addtab);
free(add_defs);
free(add_objs);
assert(!upb_ok(status));
return false;
}
bool upb_symtab_add(upb_symtab *s, upb_def *const*defs, size_t n,
void *ref_donor, upb_status *status) {
return symtab_add(s, defs, n, ref_donor, NULL, status);
}
bool upb_symtab_addfile(upb_symtab *s, upb_filedef *file, upb_status *status) {
size_t n;
size_t i;
upb_def **defs;
bool ret;
n = upb_filedef_defcount(file);
defs = malloc(sizeof(*defs) * n);
if (defs == NULL) {
upb_status_seterrmsg(status, "Out of memory");
return false;
}
for (i = 0; i < n; i++) {
defs[i] = upb_filedef_mutabledef(file, i);
}
ret = symtab_add(s, defs, n, NULL, upb_filedef_upcast_mutable(file), status);
free(defs);
return ret;
}
/* Iteration. */
static void advance_to_matching(upb_symtab_iter *iter) {

@ -108,12 +108,17 @@ class upb::SymbolTable {
* only a few messages are changing. We may want to add a way of adding a
* tree of frozen defs to the symtab (perhaps an alternate constructor where
* you pass the root of the tree?) */
bool Add(Def*const* defs, int n, void* ref_donor, upb_status* status);
bool Add(Def*const* defs, size_t n, void* ref_donor, Status* status);
bool Add(const std::vector<Def*>& defs, void *owner, Status* status) {
return Add((Def*const*)&defs[0], defs.size(), owner, status);
}
/* Resolves all subdefs for messages in this file and attempts to freeze the
* file. If this succeeds, adds all the symbols to this SymbolTable
* (replacing any existing ones with the same names). */
bool AddFile(FileDef* file, Status* s);
private:
UPB_DISALLOW_POD_OPS(SymbolTable, upb::SymbolTable)
};
@ -134,8 +139,9 @@ const upb_def *upb_symtab_resolve(const upb_symtab *s, const char *base,
const upb_def *upb_symtab_lookup(const upb_symtab *s, const char *sym);
const upb_msgdef *upb_symtab_lookupmsg(const upb_symtab *s, const char *sym);
const upb_enumdef *upb_symtab_lookupenum(const upb_symtab *s, const char *sym);
bool upb_symtab_add(upb_symtab *s, upb_def *const*defs, int n, void *ref_donor,
upb_status *status);
bool upb_symtab_add(upb_symtab *s, upb_def *const*defs, size_t n,
void *ref_donor, upb_status *status);
bool upb_symtab_addfile(upb_symtab *s, upb_filedef *file, upb_status* status);
/* upb_symtab_iter i;
* for(upb_symtab_begin(&i, s, type); !upb_symtab_done(&i);
@ -177,9 +183,12 @@ inline const MessageDef *SymbolTable::LookupMessage(const char *sym) const {
return upb_symtab_lookupmsg(this, sym);
}
inline bool SymbolTable::Add(
Def*const* defs, int n, void* ref_donor, upb_status* status) {
Def*const* defs, size_t n, void* ref_donor, Status* status) {
return upb_symtab_add(this, (upb_def*const*)defs, n, ref_donor, status);
}
inline bool SymbolTable::AddFile(FileDef* file, Status* s) {
return upb_symtab_addfile(this, file, s);
}
} /* namespace upb */
#endif

@ -299,6 +299,11 @@ template <class T> class reffed_ptr {
if (ptr_) ptr_->Ref(this);
}
reffed_ptr(const reffed_ptr& other)
: ptr_(upb::upcast(other.get())) {
if (ptr_) ptr_->Ref(this);
}
~reffed_ptr() { if (ptr_) ptr_->Unref(this); }
template <class U>

Loading…
Cancel
Save