Merge commit 'f9d27c0b8c77ebaa42dd1d287e1ec7d0c3682ad4' into upb-update

pull/21645/head
Esun Kim 5 years ago
commit 7e32ac31ca
  1. 58
      third_party/upb/BUILD
  2. 15
      third_party/upb/CMakeLists.txt
  3. 1
      third_party/upb/bazel/upb_proto_library.bzl
  4. 2
      third_party/upb/bazel/workspace_deps.bzl
  5. 4
      third_party/upb/upb/decode.c
  6. 1
      third_party/upb/upb/port.c
  7. 4
      third_party/upb/upb/port_def.inc
  8. 3
      third_party/upb/upb/table.c

@ -54,6 +54,17 @@ config_setting(
# Public C/C++ libraries #######################################################
cc_library(
name = "port",
textual_hdrs = [
"upb/port_def.inc",
"upb/port_undef.inc",
],
srcs = [
"upb/port.c",
],
)
cc_library(
name = "upb",
srcs = [
@ -62,9 +73,6 @@ cc_library(
"upb/generated_util.h",
"upb/msg.c",
"upb/msg.h",
"upb/port.c",
"upb/port_def.inc",
"upb/port_undef.inc",
"upb/table.c",
"upb/table.int.h",
"upb/upb.c",
@ -79,6 +87,7 @@ cc_library(
"//conditions:default": COPTS,
}),
visibility = ["//visibility:public"],
deps = [":port"],
)
# Common support routines used by generated code. This library has no
@ -92,17 +101,17 @@ cc_library(
hdrs = [
"upb/generated_util.h",
"upb/msg.h",
"upb/port_def.inc",
"upb/port_undef.inc",
],
copts = select({
":windows": [],
"//conditions:default": COPTS,
}),
textual_hdrs = [
"upb/port_def.inc",
"upb/port_undef.inc",
],
visibility = ["//visibility:public"],
deps = [":upb"],
deps = [
":upb",
],
)
upb_proto_library(
@ -128,6 +137,7 @@ cc_library(
visibility = ["//visibility:public"],
deps = [
":descriptor_upbproto",
":port",
":table",
":upb",
],
@ -138,7 +148,10 @@ cc_library(
cc_library(
name = "table",
hdrs = ["upb/table.int.h"],
deps = [":upb"],
deps = [
":port",
":upb",
],
)
# Legacy C/C++ Libraries (not recommended for new code) ########################
@ -146,6 +159,7 @@ cc_library(
cc_library(
name = "legacy_msg_reflection",
srcs = [
"upb/msg.h",
"upb/legacy_msg_reflection.c",
],
hdrs = ["upb/legacy_msg_reflection.h"],
@ -154,6 +168,7 @@ cc_library(
"//conditions:default": COPTS,
}),
deps = [
":port",
":table",
":upb",
],
@ -176,6 +191,7 @@ cc_library(
}),
deps = [
":reflection",
":port",
":table",
":upb",
],
@ -205,6 +221,7 @@ cc_library(
":descriptor_upbproto",
":handlers",
":reflection",
":port",
":table",
":upb",
],
@ -240,6 +257,7 @@ cc_library(
deps = [
":descriptor_upbproto",
":handlers",
":port",
":upb",
],
)
@ -259,9 +277,9 @@ cc_library(
"//conditions:default": CPPOPTS,
}),
deps = [
"@absl//absl/base:core_headers",
"@absl//absl/container:flat_hash_map",
"@absl//absl/strings",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/strings",
"@com_google_protobuf//:protobuf",
"@com_google_protobuf//:protoc_lib",
],
@ -286,6 +304,11 @@ cc_binary(
# C/C++ tests ##################################################################
upb_proto_reflection_library(
name = "descriptor_upbreflection",
deps = ["@com_google_protobuf//:descriptor_proto"],
)
cc_binary(
name = "benchmark",
testonly = 1,
@ -313,6 +336,7 @@ cc_library(
}),
deps = [
":handlers",
":port",
":upb",
],
)
@ -328,6 +352,7 @@ cc_test(
"//conditions:default": COPTS,
}),
deps = [
":port",
":upb",
":upb_pb",
":upb_test",
@ -358,6 +383,7 @@ cc_test(
}),
deps = [
":handlers",
":port",
":test_decoder_upbproto",
":upb",
":upb_pb",
@ -386,6 +412,7 @@ cc_test(
}),
deps = [
":handlers",
":port",
":reflection",
":test_cpp_upbproto",
":upb",
@ -402,6 +429,7 @@ cc_test(
"//conditions:default": CPPOPTS,
}),
deps = [
":port",
":table",
":upb",
":upb_test",
@ -431,11 +459,6 @@ cc_binary(
)
# copybara:strip_for_google3_begin
upb_proto_reflection_library(
name = "descriptor_upbreflection",
deps = ["@com_google_protobuf//:descriptor_proto"],
)
cc_test(
name = "test_encoder",
srcs = ["tests/pb/test_encoder.cc"],
@ -563,6 +586,7 @@ upb_amalgamation(
":descriptor_upbproto",
":reflection",
":handlers",
":port",
":upb_pb",
":upb_json",
],

@ -60,21 +60,22 @@ endif()
enable_testing()
add_library(port
upb/port.c)
add_library(upb
upb/decode.c
upb/encode.c
upb/generated_util.h
upb/msg.c
upb/msg.h
upb/port.c
upb/port_def.inc
upb/port_undef.inc
upb/table.c
upb/table.int.h
upb/upb.c
upb/decode.h
upb/encode.h
upb/upb.h)
target_link_libraries(upb
port)
add_library(generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE)
target_link_libraries(generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE
upb)
@ -85,15 +86,19 @@ add_library(reflection
upb/msgfactory.h)
target_link_libraries(reflection
descriptor_upbproto
port
table
upb)
add_library(table INTERFACE)
target_link_libraries(table INTERFACE
port
upb)
add_library(legacy_msg_reflection
upb/msg.h
upb/legacy_msg_reflection.c
upb/legacy_msg_reflection.h)
target_link_libraries(legacy_msg_reflection
port
table
upb)
add_library(handlers
@ -104,6 +109,7 @@ add_library(handlers
upb/sink.h)
target_link_libraries(handlers
reflection
port
table
upb)
add_library(upb_pb
@ -121,6 +127,7 @@ target_link_libraries(upb_pb
descriptor_upbproto
handlers
reflection
port
table
upb)
add_library(upb_json
@ -135,6 +142,7 @@ add_library(upb_cc_bindings INTERFACE)
target_link_libraries(upb_cc_bindings INTERFACE
descriptor_upbproto
handlers
port
upb)
add_library(upb_test
tests/testmain.cc
@ -142,6 +150,7 @@ add_library(upb_test
tests/upb_test.h)
target_link_libraries(upb_test
handlers
port
upb)

@ -279,6 +279,7 @@ _upb_proto_reflection_library_aspect = aspect(
),
"_upb": attr.label_list(
default = [
"//:generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
"//:upb",
"//:reflection",
],

@ -8,7 +8,7 @@ def upb_deps():
)
git_repository(
name = "absl",
name = "com_google_absl",
commit = "070f6e47b33a2909d039e620c873204f78809492",
remote = "https://github.com/abseil/abseil-cpp.git",
shallow_since = "1541627663 -0500",

@ -249,6 +249,10 @@ static upb_msg *upb_addmsg(upb_decframe *frame,
upb_msg *submsg;
upb_array *arr = upb_getorcreatearr(frame, field);
UPB_ASSERT(field->label == UPB_LABEL_REPEATED);
UPB_ASSERT(field->descriptortype == UPB_DESCRIPTOR_TYPE_MESSAGE ||
field->descriptortype == UPB_DESCRIPTOR_TYPE_GROUP);
*subm = frame->layout->submsgs[field->submsg_index];
submsg = upb_msg_new(*subm, frame->state->arena);
CHK(submsg);

@ -1,5 +1,4 @@
#include "upb/upb.h"
#include "upb/port_def.inc"
#ifdef UPB_MSVC_VSNPRINTF

@ -20,9 +20,7 @@
*
* This file is private and must not be included by users!
*/
#ifndef UINTPTR_MAX
#error must include stdint.h first
#endif
#include <stdint.h>
#if UINTPTR_MAX == 0xffffffff
#define UPB_SIZE(size32, size64) size32

@ -756,7 +756,8 @@ uint32_t upb_murmur_hash2(const void *key, size_t len, uint32_t seed) {
/* Mix 4 bytes at a time into the hash */
const uint8_t * data = (const uint8_t *)key;
while(len >= 4) {
uint32_t k = *(uint32_t *)data;
uint32_t k;
memcpy(&k, data, sizeof(k));
k *= m;
k ^= k >> r;

Loading…
Cancel
Save