summaryrefslogtreecommitdiff
path: root/upb
diff options
context:
space:
mode:
authorJosh Haberman <jhaberman@gmail.com>2019-01-28 11:40:37 -0800
committerJosh Haberman <jhaberman@gmail.com>2019-01-28 11:40:37 -0800
commit8e737d4f9acd3bb7620fdb237f5b943b41b75e9e (patch)
tree0c740d4a51859aa7b60c4c7efc53f831ffde552f /upb
parent68d86cbc5906b6821fd2d44080634891fb9f3fab (diff)
Discard extensions since current symtab can't handle them.
Diffstat (limited to 'upb')
-rw-r--r--upb/descriptor/reader.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/upb/descriptor/reader.c b/upb/descriptor/reader.c
index 054ebd2..fd219fe 100644
--- a/upb/descriptor/reader.c
+++ b/upb/descriptor/reader.c
@@ -321,14 +321,21 @@ static void *file_startenum(void *closure, const void *hd) {
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(ok);
return r;
}
+static bool file_endext(void *closure, const void *hd) {
+ /* The current symtab code can't handle extensions, so we just discard
+ * them for now. */
+ upb_descreader *r = closure;
+ upb_fielddef_unref(r->f, r);
+ UPB_UNUSED(hd);
+ r->f = NULL;
+ return true;
+}
+
static size_t file_ondep(void *closure, const void *hd, const char *buf,
size_t n, const upb_bufhandle *handle) {
upb_descreader *r = closure;
@@ -702,13 +709,21 @@ static void *msg_startmsg(void *closure, const void *hd) {
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);
+ r->f = upb_fielddef_new(r);
UPB_UNUSED(hd);
- UPB_ASSERT(ok);
return r;
}
+static bool msg_endext(void *closure, const void *hd) {
+ /* The current symtab code can't handle extensions, so we just discard
+ * them for now. */
+ upb_descreader *r = closure;
+ upb_fielddef_unref(r->f, r);
+ UPB_UNUSED(hd);
+ r->f = NULL;
+ return true;
+}
+
static void *msg_startfield(void *closure, const void *hd) {
upb_descreader *r = closure;
r->f = upb_fielddef_new(&r->f);
@@ -763,6 +778,8 @@ static void reghandlers(const void *closure, upb_handlers *h) {
upb_handlers_setstring(h, F(DescriptorProto, name), &msg_name, NULL);
upb_handlers_setstartsubmsg(h, F(DescriptorProto, extension), &msg_startext,
NULL);
+ upb_handlers_setendsubmsg(h, F(DescriptorProto, extension), &msg_endext,
+ NULL);
upb_handlers_setstartsubmsg(h, F(DescriptorProto, nested_type),
&msg_startmsg, NULL);
upb_handlers_setstartsubmsg(h, F(DescriptorProto, field),
@@ -786,6 +803,8 @@ static void reghandlers(const void *closure, upb_handlers *h) {
&file_startenum, NULL);
upb_handlers_setstartsubmsg(h, F(FileDescriptorProto, extension),
&file_startext, NULL);
+ upb_handlers_setendsubmsg(h, F(FileDescriptorProto, extension),
+ &file_endext, NULL);
upb_handlers_setstring(h, F(FileDescriptorProto, dependency),
&file_ondep, NULL);
} else if (upbdefs_google_protobuf_EnumValueDescriptorProto_is(m)) {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback