upb: create upb/reflection/internal/

Also fixed a bunch of compiler warnings about mismatched integer comparison types

PiperOrigin-RevId: 557213908
pull/13675/head^2
Eric Salo 2 years ago committed by Copybara-Service
parent 2344281bb6
commit 56a6ecd142
  1. 32
      BUILD
  2. 4
      upb/reflection/def.hpp
  3. 3
      upb/reflection/def_builder.c
  4. 3
      upb/reflection/def_builder_test.cc
  5. 17
      upb/reflection/def_pool.c
  6. 2
      upb/reflection/desc_state.c
  7. 21
      upb/reflection/enum_def.c
  8. 7
      upb/reflection/enum_reserved_range.c
  9. 11
      upb/reflection/enum_value_def.c
  10. 5
      upb/reflection/extension_range.c
  11. 20
      upb/reflection/field_def.c
  12. 15
      upb/reflection/file_def.c
  13. 2
      upb/reflection/internal/def_builder.h
  14. 0
      upb/reflection/internal/def_pool.h
  15. 0
      upb/reflection/internal/desc_state.h
  16. 0
      upb/reflection/internal/enum_def.h
  17. 0
      upb/reflection/internal/enum_reserved_range.h
  18. 0
      upb/reflection/internal/enum_value_def.h
  19. 0
      upb/reflection/internal/extension_range.h
  20. 0
      upb/reflection/internal/field_def.h
  21. 0
      upb/reflection/internal/file_def.h
  22. 0
      upb/reflection/internal/message_def.h
  23. 0
      upb/reflection/internal/message_reserved_range.h
  24. 0
      upb/reflection/internal/method_def.h
  25. 0
      upb/reflection/internal/oneof_def.h
  26. 0
      upb/reflection/internal/service_def.h
  27. 2
      upb/reflection/message.c
  28. 21
      upb/reflection/message_def.c
  29. 4
      upb/reflection/message_reserved_range.c
  30. 5
      upb/reflection/method_def.c
  31. 9
      upb/reflection/oneof_def.c
  32. 9
      upb/reflection/service_def.c
  33. 16
      upb/util/def_to_proto.c
  34. 2
      upbc/protoc-gen-upbdefs.cc

32
BUILD

@ -449,7 +449,7 @@ cc_library(
"upb/port/def.inc",
"upb/port/undef.inc",
"upb/reflection/def.h",
"upb/reflection/def_pool_internal.h",
"upb/reflection/internal/def_pool.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
@ -539,35 +539,35 @@ bootstrap_cc_library(
"upb/reflection/common.h",
"upb/reflection/def.h",
"upb/reflection/def.hpp",
"upb/reflection/def_builder_internal.h",
"upb/reflection/def_pool.h",
"upb/reflection/def_pool_internal.h",
"upb/reflection/def_type.h",
"upb/reflection/desc_state_internal.h",
"upb/reflection/enum_def.h",
"upb/reflection/enum_def_internal.h",
"upb/reflection/enum_reserved_range.h",
"upb/reflection/enum_reserved_range_internal.h",
"upb/reflection/enum_value_def.h",
"upb/reflection/enum_value_def_internal.h",
"upb/reflection/extension_range.h",
"upb/reflection/extension_range_internal.h",
"upb/reflection/field_def.h",
"upb/reflection/field_def_internal.h",
"upb/reflection/file_def.h",
"upb/reflection/file_def_internal.h",
"upb/reflection/internal/def_builder.h",
"upb/reflection/internal/def_pool.h",
"upb/reflection/internal/desc_state.h",
"upb/reflection/internal/enum_def.h",
"upb/reflection/internal/enum_reserved_range.h",
"upb/reflection/internal/enum_value_def.h",
"upb/reflection/internal/extension_range.h",
"upb/reflection/internal/field_def.h",
"upb/reflection/internal/file_def.h",
"upb/reflection/internal/message_def.h",
"upb/reflection/internal/message_reserved_range.h",
"upb/reflection/internal/method_def.h",
"upb/reflection/internal/oneof_def.h",
"upb/reflection/internal/service_def.h",
"upb/reflection/message.h",
"upb/reflection/message.hpp",
"upb/reflection/message_def.h",
"upb/reflection/message_def_internal.h",
"upb/reflection/message_reserved_range.h",
"upb/reflection/message_reserved_range_internal.h",
"upb/reflection/method_def.h",
"upb/reflection/method_def_internal.h",
"upb/reflection/oneof_def.h",
"upb/reflection/oneof_def_internal.h",
"upb/reflection/service_def.h",
"upb/reflection/service_def_internal.h",
],
bootstrap_deps = [":descriptor_upb_proto"],
copts = UPB_DEFAULT_COPTS,
@ -722,9 +722,9 @@ cc_test(
name = "def_builder_test",
srcs = [
"upb/reflection/common.h",
"upb/reflection/def_builder_internal.h",
"upb/reflection/def_builder_test.cc",
"upb/reflection/def_type.h",
"upb/reflection/internal/def_builder.h",
],
deps = [
":descriptor_upb_proto",

@ -37,8 +37,8 @@
#include <vector>
#include "upb/reflection/def.h"
#include "upb/reflection/def_pool_internal.h"
#include "upb/reflection/enum_def_internal.h"
#include "upb/reflection/internal/def_pool.h"
#include "upb/reflection/internal/enum_def.h"
#include "upb/reflection/message.h"
#include "upb/upb.hpp"

@ -28,9 +28,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "upb/reflection/internal/def_builder.h"
#include <string.h>
#include "upb/reflection/def_builder_internal.h"
#include "upb/reflection/def_pool.h"
#include "upb/reflection/def_type.h"
#include "upb/reflection/field_def.h"

@ -28,9 +28,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "upb/reflection/internal/def_builder.h"
#include "gtest/gtest.h"
#include "absl/strings/string_view.h"
#include "upb/reflection/def_builder_internal.h"
#include "upb/upb.hpp"
// Must be last.

@ -28,17 +28,18 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "upb/reflection/internal/def_pool.h"
#include "upb/hash/int_table.h"
#include "upb/hash/str_table.h"
#include "upb/reflection/def_builder_internal.h"
#include "upb/reflection/def_pool_internal.h"
#include "upb/reflection/def_type.h"
#include "upb/reflection/enum_def_internal.h"
#include "upb/reflection/enum_value_def_internal.h"
#include "upb/reflection/field_def_internal.h"
#include "upb/reflection/file_def_internal.h"
#include "upb/reflection/message_def_internal.h"
#include "upb/reflection/service_def_internal.h"
#include "upb/reflection/internal/def_builder.h"
#include "upb/reflection/internal/enum_def.h"
#include "upb/reflection/internal/enum_value_def.h"
#include "upb/reflection/internal/field_def.h"
#include "upb/reflection/internal/file_def.h"
#include "upb/reflection/internal/message_def.h"
#include "upb/reflection/internal/service_def.h"
// Must be last.
#include "upb/port/def.inc"

@ -28,7 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "upb/reflection/desc_state_internal.h"
#include "upb/reflection/internal/desc_state.h"
// Must be last.
#include "upb/port/def.inc"

@ -28,17 +28,18 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "upb/reflection/internal/enum_def.h"
#include "upb/hash/int_table.h"
#include "upb/hash/str_table.h"
#include "upb/mini_descriptor/decode.h"
#include "upb/reflection/def_builder_internal.h"
#include "upb/reflection/def_type.h"
#include "upb/reflection/desc_state_internal.h"
#include "upb/reflection/enum_def_internal.h"
#include "upb/reflection/enum_reserved_range_internal.h"
#include "upb/reflection/enum_value_def_internal.h"
#include "upb/reflection/file_def_internal.h"
#include "upb/reflection/message_def_internal.h"
#include "upb/reflection/internal/def_builder.h"
#include "upb/reflection/internal/desc_state.h"
#include "upb/reflection/internal/enum_reserved_range.h"
#include "upb/reflection/internal/enum_value_def.h"
#include "upb/reflection/internal/file_def.h"
#include "upb/reflection/internal/message_def.h"
// Must be last.
#include "upb/port/def.inc"
@ -180,7 +181,7 @@ bool upb_EnumDef_MiniDescriptorEncode(const upb_EnumDef* e, upb_Arena* a,
// Duplicate values are allowed but we only encode each value once.
uint32_t previous = 0;
for (size_t i = 0; i < e->value_count; i++) {
for (int i = 0; i < e->value_count; i++) {
const uint32_t current =
upb_EnumValueDef_Number(sorted ? sorted[i] : upb_EnumDef_Value(e, i));
if (i != 0 && previous == current) continue;
@ -220,7 +221,7 @@ static upb_MiniTableEnum* create_enumlayout(upb_DefBuilder* ctx,
static upb_StringView* _upb_EnumReservedNames_New(
upb_DefBuilder* ctx, int n, const upb_StringView* protos) {
upb_StringView* sv = _upb_DefBuilder_Alloc(ctx, sizeof(upb_StringView) * n);
for (size_t i = 0; i < n; i++) {
for (int i = 0; i < n; i++) {
sv[i].data =
upb_strdup2(protos[i].data, protos[i].size, _upb_DefBuilder_Arena(ctx));
sv[i].size = protos[i].size;
@ -305,7 +306,7 @@ upb_EnumDef* _upb_EnumDefs_New(
: _upb_FileDef_RawPackage(ctx->file);
upb_EnumDef* e = _upb_DefBuilder_Alloc(ctx, sizeof(upb_EnumDef) * n);
for (size_t i = 0; i < n; i++) {
for (int i = 0; i < n; i++) {
create_enumdef(ctx, name, protos[i], &e[i]);
e[i].containing_type = containing_type;
}

@ -28,12 +28,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "upb/reflection/def_builder_internal.h"
#include "upb/reflection/internal/enum_reserved_range.h"
#include "upb/reflection/enum_def.h"
#include "upb/reflection/enum_reserved_range_internal.h"
// #include "upb/reflection/extension_range_internal.h"
#include "upb/reflection/field_def.h"
// #include "upb/reflection/message_def.h"
#include "upb/reflection/internal/def_builder.h"
// Must be last.
#include "upb/port/def.inc"

@ -28,11 +28,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "upb/reflection/def_builder_internal.h"
#include "upb/reflection/internal/enum_value_def.h"
#include "upb/reflection/def_type.h"
#include "upb/reflection/enum_def_internal.h"
#include "upb/reflection/enum_value_def_internal.h"
#include "upb/reflection/file_def_internal.h"
#include "upb/reflection/internal/def_builder.h"
#include "upb/reflection/internal/enum_def.h"
#include "upb/reflection/internal/file_def.h"
// Must be last.
#include "upb/port/def.inc"
@ -128,7 +129,7 @@ upb_EnumValueDef* _upb_EnumValueDefs_New(
*is_sorted = true;
uint32_t previous = 0;
for (size_t i = 0; i < n; i++) {
for (int i = 0; i < n; i++) {
create_enumvaldef(ctx, prefix, protos[i], e, &v[i]);
const uint32_t current = v[i].number;

@ -28,9 +28,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "upb/reflection/def_builder_internal.h"
#include "upb/reflection/extension_range_internal.h"
#include "upb/reflection/internal/extension_range.h"
#include "upb/reflection/field_def.h"
#include "upb/reflection/internal/def_builder.h"
#include "upb/reflection/message_def.h"
// Must be last.

@ -28,22 +28,23 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "upb/reflection/internal/field_def.h"
#include <ctype.h>
#include <errno.h>
#include "upb/mini_descriptor/decode.h"
#include "upb/mini_descriptor/internal/modifiers.h"
#include "upb/reflection/def.h"
#include "upb/reflection/def_builder_internal.h"
#include "upb/reflection/def_pool.h"
#include "upb/reflection/def_type.h"
#include "upb/reflection/desc_state_internal.h"
#include "upb/reflection/enum_def_internal.h"
#include "upb/reflection/enum_value_def_internal.h"
#include "upb/reflection/field_def_internal.h"
#include "upb/reflection/file_def_internal.h"
#include "upb/reflection/message_def_internal.h"
#include "upb/reflection/oneof_def_internal.h"
#include "upb/reflection/internal/def_builder.h"
#include "upb/reflection/internal/desc_state.h"
#include "upb/reflection/internal/enum_def.h"
#include "upb/reflection/internal/enum_value_def.h"
#include "upb/reflection/internal/file_def.h"
#include "upb/reflection/internal/message_def.h"
#include "upb/reflection/internal/oneof_def.h"
// Must be last.
#include "upb/port/def.inc"
@ -624,8 +625,7 @@ static void _upb_FieldDef_Create(upb_DefBuilder* ctx, const char* prefix,
}
if (UPB_DESC(FieldDescriptorProto_has_oneof_index)(field_proto)) {
uint32_t oneof_index =
UPB_DESC(FieldDescriptorProto_oneof_index)(field_proto);
int oneof_index = UPB_DESC(FieldDescriptorProto_oneof_index)(field_proto);
if (upb_FieldDef_Label(f) != kUpb_Label_Optional) {
_upb_DefBuilder_Errf(ctx, "fields in oneof must have OPTIONAL label (%s)",

@ -28,13 +28,14 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "upb/reflection/def_builder_internal.h"
#include "upb/reflection/internal/file_def.h"
#include "upb/reflection/def_pool.h"
#include "upb/reflection/enum_def_internal.h"
#include "upb/reflection/field_def_internal.h"
#include "upb/reflection/file_def_internal.h"
#include "upb/reflection/message_def_internal.h"
#include "upb/reflection/service_def_internal.h"
#include "upb/reflection/internal/def_builder.h"
#include "upb/reflection/internal/enum_def.h"
#include "upb/reflection/internal/field_def.h"
#include "upb/reflection/internal/message_def.h"
#include "upb/reflection/internal/service_def.h"
// Must be last.
#include "upb/port/def.inc"
@ -207,7 +208,7 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx,
UPB_DESC(FileDescriptorProto_extension)(file_proto, &n);
int ext_count = n;
msgs = UPB_DESC(FileDescriptorProto_message_type)(file_proto, &n);
for (int i = 0; i < n; i++) {
for (size_t i = 0; i < n; i++) {
ext_count += count_exts_in_msg(msgs[i]);
}
file->ext_count = ext_count;

@ -32,8 +32,8 @@
#define UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_
#include "upb/reflection/common.h"
#include "upb/reflection/def_pool_internal.h"
#include "upb/reflection/def_type.h"
#include "upb/reflection/internal/def_pool.h"
// Must be last.
#include "upb/port/def.inc"

@ -40,7 +40,7 @@
#include "upb/reflection/def.h"
#include "upb/reflection/def_pool.h"
#include "upb/reflection/def_type.h"
#include "upb/reflection/field_def_internal.h"
#include "upb/reflection/internal/field_def.h"
#include "upb/reflection/message_def.h"
#include "upb/reflection/oneof_def.h"

@ -28,21 +28,22 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "upb/reflection/internal/message_def.h"
#include "upb/hash/int_table.h"
#include "upb/hash/str_table.h"
#include "upb/mini_descriptor/decode.h"
#include "upb/mini_descriptor/internal/modifiers.h"
#include "upb/reflection/def.h"
#include "upb/reflection/def_builder_internal.h"
#include "upb/reflection/def_type.h"
#include "upb/reflection/desc_state_internal.h"
#include "upb/reflection/enum_def_internal.h"
#include "upb/reflection/extension_range_internal.h"
#include "upb/reflection/field_def_internal.h"
#include "upb/reflection/file_def_internal.h"
#include "upb/reflection/message_def_internal.h"
#include "upb/reflection/message_reserved_range_internal.h"
#include "upb/reflection/oneof_def_internal.h"
#include "upb/reflection/internal/def_builder.h"
#include "upb/reflection/internal/desc_state.h"
#include "upb/reflection/internal/enum_def.h"
#include "upb/reflection/internal/extension_range.h"
#include "upb/reflection/internal/field_def.h"
#include "upb/reflection/internal/file_def.h"
#include "upb/reflection/internal/message_reserved_range.h"
#include "upb/reflection/internal/oneof_def.h"
// Must be last.
#include "upb/port/def.inc"
@ -612,7 +613,7 @@ bool upb_MessageDef_MiniDescriptorEncode(const upb_MessageDef* m, upb_Arena* a,
static upb_StringView* _upb_ReservedNames_New(upb_DefBuilder* ctx, int n,
const upb_StringView* protos) {
upb_StringView* sv = _upb_DefBuilder_Alloc(ctx, sizeof(upb_StringView) * n);
for (size_t i = 0; i < n; i++) {
for (int i = 0; i < n; i++) {
sv[i].data =
upb_strdup2(protos[i].data, protos[i].size, _upb_DefBuilder_Arena(ctx));
sv[i].size = protos[i].size;

@ -28,10 +28,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "upb/reflection/def_builder_internal.h"
#include "upb/reflection/enum_def.h"
#include "upb/reflection/extension_range_internal.h"
#include "upb/reflection/field_def.h"
#include "upb/reflection/internal/def_builder.h"
#include "upb/reflection/internal/extension_range.h"
#include "upb/reflection/message_def.h"
// Must be last.

@ -28,9 +28,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "upb/reflection/def_builder_internal.h"
#include "upb/reflection/internal/method_def.h"
#include "upb/reflection/def_type.h"
#include "upb/reflection/method_def_internal.h"
#include "upb/reflection/internal/def_builder.h"
#include "upb/reflection/service_def.h"
// Must be last.

@ -28,17 +28,18 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "upb/reflection/internal/oneof_def.h"
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "upb/hash/int_table.h"
#include "upb/hash/str_table.h"
#include "upb/reflection/def_builder_internal.h"
#include "upb/reflection/def_type.h"
#include "upb/reflection/field_def_internal.h"
#include "upb/reflection/message_def_internal.h"
#include "upb/reflection/oneof_def_internal.h"
#include "upb/reflection/internal/def_builder.h"
#include "upb/reflection/internal/field_def.h"
#include "upb/reflection/internal/message_def.h"
// Must be last.
#include "upb/port/def.inc"

@ -28,11 +28,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "upb/reflection/def_builder_internal.h"
#include "upb/reflection/internal/service_def.h"
#include "upb/reflection/def_type.h"
#include "upb/reflection/file_def_internal.h"
#include "upb/reflection/method_def_internal.h"
#include "upb/reflection/service_def_internal.h"
#include "upb/reflection/internal/def_builder.h"
#include "upb/reflection/internal/file_def.h"
#include "upb/reflection/internal/method_def.h"
// Must be last.
#include "upb/port/def.inc"

@ -36,8 +36,8 @@
#include "upb/port/vsnprintf_compat.h"
#include "upb/reflection/enum_reserved_range.h"
#include "upb/reflection/extension_range.h"
#include "upb/reflection/field_def_internal.h"
#include "upb/reflection/file_def_internal.h"
#include "upb/reflection/internal/field_def.h"
#include "upb/reflection/internal/file_def.h"
#include "upb/reflection/message.h"
#include "upb/reflection/message_reserved_range.h"
@ -499,7 +499,7 @@ static google_protobuf_ServiceDescriptorProto* servicedef_toproto(
size_t n = upb_ServiceDef_MethodCount(s);
google_protobuf_MethodDescriptorProto** methods =
google_protobuf_ServiceDescriptorProto_resize_method(proto, n, ctx->arena);
for (int i = 0; i < n; i++) {
for (size_t i = 0; i < n; i++) {
methods[i] = methoddef_toproto(ctx, upb_ServiceDef_Method(s, i));
}
@ -544,7 +544,7 @@ static google_protobuf_FileDescriptorProto* filedef_toproto(upb_ToProto_Context*
n = upb_FileDef_DependencyCount(f);
upb_StringView* deps =
google_protobuf_FileDescriptorProto_resize_dependency(proto, n, ctx->arena);
for (int i = 0; i < n; i++) {
for (size_t i = 0; i < n; i++) {
deps[i] = strviewdup(ctx, upb_FileDef_Name(upb_FileDef_Dependency(f, i)));
}
@ -563,28 +563,28 @@ static google_protobuf_FileDescriptorProto* filedef_toproto(upb_ToProto_Context*
n = upb_FileDef_TopLevelMessageCount(f);
google_protobuf_DescriptorProto** msgs =
google_protobuf_FileDescriptorProto_resize_message_type(proto, n, ctx->arena);
for (int i = 0; i < n; i++) {
for (size_t i = 0; i < n; i++) {
msgs[i] = msgdef_toproto(ctx, upb_FileDef_TopLevelMessage(f, i));
}
n = upb_FileDef_TopLevelEnumCount(f);
google_protobuf_EnumDescriptorProto** enums =
google_protobuf_FileDescriptorProto_resize_enum_type(proto, n, ctx->arena);
for (int i = 0; i < n; i++) {
for (size_t i = 0; i < n; i++) {
enums[i] = enumdef_toproto(ctx, upb_FileDef_TopLevelEnum(f, i));
}
n = upb_FileDef_ServiceCount(f);
google_protobuf_ServiceDescriptorProto** services =
google_protobuf_FileDescriptorProto_resize_service(proto, n, ctx->arena);
for (int i = 0; i < n; i++) {
for (size_t i = 0; i < n; i++) {
services[i] = servicedef_toproto(ctx, upb_FileDef_Service(f, i));
}
n = upb_FileDef_TopLevelExtensionCount(f);
google_protobuf_FieldDescriptorProto** exts =
google_protobuf_FileDescriptorProto_resize_extension(proto, n, ctx->arena);
for (int i = 0; i < n; i++) {
for (size_t i = 0; i < n; i++) {
exts[i] = fielddef_toproto(ctx, upb_FileDef_TopLevelExtension(f, i));
}

@ -68,7 +68,7 @@ void WriteDefHeader(upb::FileDefPtr file, Output& output) {
"#ifndef $0_UPBDEFS_H_\n"
"#define $0_UPBDEFS_H_\n\n"
"#include \"upb/reflection/def.h\"\n"
"#include \"upb/reflection/def_pool_internal.h\"\n"
"#include \"upb/reflection/internal/def_pool.h\"\n"
"#include \"upb/port/def.inc\"\n"
"#ifdef __cplusplus\n"
"extern \"C\" {\n"

Loading…
Cancel
Save