No public description

PiperOrigin-RevId: 556849883
pull/13675/head^2
Protobuf Team Bot 2 years ago committed by Copybara-Service
parent 5aca728f72
commit c552102d66
  1. 449
      BUILD
  2. 13
      cmake/BUILD.bazel
  3. 10
      cmake/make_cmakelists.py
  4. 4
      lua/BUILD.bazel
  5. 18
      lua/main.c
  6. 5
      lua/msg.c
  7. 3
      lua/test_upb.lua
  8. 2
      lua/upb.c
  9. 2
      lua/upb.h
  10. 2
      protos/BUILD
  11. 2
      protos/repeated_field.h
  12. 3
      python/BUILD
  13. 5
      python/dist/BUILD.bazel
  14. 124
      upb/collections/BUILD
  15. 4
      upb/collections/array.c
  16. 26
      upb/collections/array_test.cc
  17. 6
      upb/collections/internal/array.h
  18. 6
      upb/collections/internal/map.h
  19. 8
      upb/collections/internal/map_sorter.h
  20. 2
      upb/collections/map.c
  21. 2
      upb/collections/map_gencode_util.h
  22. 3
      upb/collections/map_sorter.c
  23. 28
      upb/collections/map_test.cc
  24. 26
      upb/conformance/BUILD
  25. 39
      upb/decode.h
  26. 39
      upb/decode_fast.h
  27. 38
      upb/def.hpp
  28. 39
      upb/encode.h
  29. 2
      upb/generated_code_support.h
  30. 73
      upb/hash/BUILD
  31. 71
      upb/lex/BUILD
  32. 3
      upb/mem/BUILD
  33. 2
      upb/message/accessors.c
  34. 4
      upb/message/accessors.h
  35. 18
      upb/message/copy.c
  36. 2
      upb/message/copy.h
  37. 62
      upb/message/copy_test.cc
  38. 2
      upb/message/internal/accessors.h
  39. 2
      upb/message/promote.c
  40. 47
      upb/mini_descriptor/BUILD
  41. 3
      upb/mini_table/BUILD
  42. 39
      upb/msg.h
  43. 4
      upb/test/BUILD
  44. 64
      upb/text/BUILD
  45. 2
      upb/text/encode.c
  46. 135
      upb/wire/BUILD
  47. 4
      upb/wire/decode.c
  48. 2
      upb/wire/decode_fast.c
  49. 4
      upb/wire/encode.c
  50. 5
      upbc/BUILD
  51. 2
      upbc/bootstrap_compiler.bzl

449
BUILD

@ -23,11 +23,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.
load(
"//bazel:build_defs.bzl",
"UPB_DEFAULT_COPTS",
"UPB_DEFAULT_CPPOPTS",
)
load("//bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
load(
"//bazel:upb_proto_library.bzl",
"upb_proto_library",
@ -127,32 +123,20 @@ cc_library(
cc_library(
name = "upb",
hdrs = [
"upb/collections/array.h",
"upb/decode.h",
"upb/encode.h",
"upb/message/extension_internal.h",
"upb/message/message.h",
"upb/msg.h",
"upb/upb.h",
"upb/upb.hpp",
"upb/wire/common.h",
"upb/wire/decode.h",
"upb/wire/encode.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":base",
":base_internal",
":collections_internal",
":fastdecode",
":hash",
":lex",
":mem",
":message_internal",
":mini_table",
":port",
":wire",
],
)
@ -237,11 +221,12 @@ cc_library(
":eps_copy_input_stream",
":message_internal",
":mini_table",
":mini_table_internal",
":port",
":upb",
":wire",
":wire_internal",
":wire_reader",
"//upb/mini_table:internal",
],
)
@ -261,11 +246,12 @@ cc_library(
":hash",
":message_accessors",
":message_internal",
":mini_table",
":port",
":upb",
":wire",
":wire_internal",
":wire_reader",
"//upb/mini_table",
],
)
@ -280,13 +266,16 @@ cc_library(
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":base",
":collections_internal",
":mem",
":message_accessors",
":message_internal",
":message_typedef",
":mini_table",
":mini_table_internal",
":port",
":upb",
"//upb/mini_table",
],
)
@ -320,12 +309,14 @@ cc_test(
":base",
":collections",
":message_accessors",
":mini_descriptor",
":mini_descriptor_encode_internal",
":mini_descriptor_internal",
":mini_table",
":port",
":upb",
"//upb/mini_descriptor",
"//upb/mini_descriptor:encode_internal",
"//upb/mini_descriptor:internal",
"//upb/mini_table",
":wire",
":wire_internal",
"//upb/test:test_messages_proto2_upb_proto",
"//upb/test:test_messages_proto3_upb_proto",
"//upb/test:test_upb_proto",
@ -344,11 +335,13 @@ cc_test(
":message_accessors",
":message_copy",
":message_promote",
":mini_descriptor_encode_internal",
":mini_descriptor_internal",
":mini_table",
":port",
":upb",
"//upb/mini_descriptor:encode_internal",
"//upb/mini_descriptor:internal",
"//upb/mini_table",
":wire",
":wire_internal",
"//upb/test:test_messages_proto2_upb_proto",
"//upb/test:test_messages_proto3_upb_proto",
"//upb/test:test_upb_proto",
@ -367,8 +360,10 @@ cc_test(
":mem",
":message_accessors",
":message_copy",
":message_internal",
":mini_table",
":upb",
":wire",
"//upb/test:test_messages_proto2_upb_proto",
"//upb/test:test_messages_proto3_upb_proto",
"//upb/test:test_upb_proto",
@ -415,10 +410,10 @@ cc_library(
":message_accessors",
":message_accessors_internal",
":message_internal",
":mini_descriptor",
":mini_table",
":upb",
":wire_internal",
"//upb/mini_descriptor",
],
)
@ -439,6 +434,7 @@ cc_library(
":hash",
":mem",
":message_copy",
":message_typedef",
":mini_table",
":upb",
],
@ -456,8 +452,8 @@ cc_library(
visibility = ["//visibility:public"],
deps = [
":mem",
":mini_descriptor",
":reflection_internal",
"//upb/mini_descriptor",
],
)
@ -481,75 +477,16 @@ upb_proto_reflection_library(
deps = ["@com_google_protobuf//:descriptor_proto"],
)
cc_library(
name = "collections",
hdrs = [
"upb/collections/array.h",
"upb/collections/map.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":base",
":collections_internal",
":mem",
":port",
],
)
cc_library(
name = "message_rep_internal",
hdrs = [
"upb/message/internal/map_entry.h",
],
copts = UPB_DEFAULT_COPTS,
deps = [
":base",
":hash",
],
)
cc_library(
name = "collections_internal",
srcs = [
"upb/collections/array.c",
"upb/collections/map.c",
"upb/collections/map_sorter.c",
],
hdrs = [
"upb/collections/array.h",
"upb/collections/array_internal.h",
"upb/collections/map.h",
"upb/collections/map_gencode_util.h",
"upb/collections/map_internal.h",
"upb/collections/map_sorter_internal.h",
"upb/collections/message_value.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//:__subpackages__"],
deps = [
":base",
":base_internal",
":hash",
":mem",
":message_internal",
":message_rep_internal",
":message_tagged_ptr",
":mini_table",
":port",
],
)
cc_library(
name = "collections_split64",
hdrs = [
"upb/collections/array_split64.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":collections",
":port",
],
)
@ -559,7 +496,6 @@ bootstrap_cc_library(
name = "reflection",
hdrs = [
"upb/def.h",
"upb/def.hpp",
"upb/reflection/def.h",
"upb/reflection/def.hpp",
"upb/reflection/message.h",
@ -639,38 +575,17 @@ bootstrap_cc_library(
":hash",
":mem",
":message_accessors",
":mini_descriptor",
":mini_descriptor_encode_internal",
":mini_descriptor_internal",
":mini_table",
":port",
":upb",
"//upb/mini_descriptor",
"//upb/mini_descriptor:encode_internal",
"//upb/mini_descriptor:internal",
"//upb/mini_table",
],
)
cc_library(
name = "textformat",
srcs = [
"upb/text/encode.c",
],
hdrs = [
"upb/text/encode.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":collections_internal",
":eps_copy_input_stream",
":lex",
":port",
":reflection",
":wire",
":wire_reader",
":wire_types",
],
)
# Aliases ######################################################################
# TODO(b/295870230): Remove these.
alias(
name = "base",
@ -684,12 +599,42 @@ alias(
visibility = ["//visibility:public"],
)
alias(
name = "collections",
actual = "//upb/collections",
visibility = ["//visibility:public"],
)
alias(
name = "collections_internal",
actual = "//upb/collections:internal",
visibility = ["//visibility:public"],
)
alias(
name = "collections_split64",
actual = "//upb/collections:split64",
visibility = ["//visibility:public"],
)
alias(
name = "hash",
actual = "//upb/hash",
visibility = ["//visibility:public"],
)
alias(
name = "json",
actual = "//upb/json",
visibility = ["//visibility:public"],
)
alias(
name = "lex",
actual = "//upb/lex",
visibility = ["//visibility:public"],
)
alias(
name = "mem",
actual = "//upb/mem",
@ -702,6 +647,24 @@ alias(
visibility = ["//:__subpackages__"],
)
alias(
name = "mini_descriptor",
actual = "//upb/mini_descriptor",
visibility = ["//visibility:public"],
)
alias(
name = "mini_descriptor_encode_internal",
actual = "//upb/mini_descriptor:encode_internal",
visibility = ["//:__subpackages__"],
)
alias(
name = "mini_descriptor_internal",
actual = "//upb/mini_descriptor:internal",
visibility = ["//:__subpackages__"],
)
alias(
name = "mini_table",
actual = "//upb/mini_table",
@ -714,6 +677,42 @@ alias(
visibility = ["//:friends"],
)
alias(
name = "text",
actual = "//upb/text",
visibility = ["//visibility:public"],
)
alias(
name = "wire",
actual = "//upb/wire",
visibility = ["//visibility:public"],
)
alias(
name = "wire_internal",
actual = "//upb/wire:internal",
visibility = ["//visibility:public"],
)
alias(
name = "wire_reader",
actual = "//upb/wire:reader",
visibility = ["//visibility:public"],
)
alias(
name = "wire_types",
actual = "//upb/wire:types",
visibility = ["//visibility:public"],
)
alias(
name = "eps_copy_input_stream",
actual = "//upb/wire:eps_copy_input_stream",
visibility = ["//visibility:public"],
)
# Tests ########################################################################
cc_test(
@ -736,17 +735,6 @@ cc_test(
],
)
cc_test(
name = "collections_test",
srcs = ["upb/collections/test.cc"],
deps = [
":base",
":collections",
":upb",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "message_test",
srcs = ["upb/message/test.cc"],
@ -756,7 +744,7 @@ cc_test(
":message_test_upb_proto_reflection",
":reflection",
":upb",
"//upb/json",
":wire",
"//upb/test:fuzz_util",
"//upb/test:test_messages_proto3_upb_proto",
"@com_google_googletest//:gtest_main",
@ -782,163 +770,8 @@ upb_proto_reflection_library(
deps = [":message_test_proto"],
)
cc_test(
name = "atoi_test",
srcs = ["upb/lex/atoi_test.cc"],
copts = UPB_DEFAULT_CPPOPTS,
deps = [
":lex",
"@com_google_absl//absl/strings",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "hash_test",
srcs = ["upb/hash/test.cc"],
copts = UPB_DEFAULT_CPPOPTS,
deps = [
":hash",
":port",
":upb",
"@com_google_googletest//:gtest_main",
],
)
# Internal C/C++ libraries #####################################################
cc_library(
name = "wire",
hdrs = [
"upb/wire/decode.h",
"upb/wire/encode.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":mem",
":message_internal",
":mini_table",
":port",
":wire_internal",
],
)
cc_library(
name = "wire_internal",
srcs = [
"upb/wire/decode.c",
"upb/wire/decode_fast.c",
"upb/wire/encode.c",
],
hdrs = [
"upb/wire/common.h",
"upb/wire/decode.h",
"upb/wire/decode_fast.h",
"upb/wire/encode.h",
"upb/wire/internal/common.h",
"upb/wire/internal/decode.h",
"upb/wire/internal/swap.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//:__subpackages__"],
deps = [
":base",
":collections_internal",
":eps_copy_input_stream",
":mem_internal",
":message_accessors_internal",
":message_internal",
":message_rep_internal",
":mini_table",
":port",
":wire_reader",
":wire_types",
"@utf8_range",
],
)
cc_library(
name = "wire_types",
hdrs = ["upb/wire/types.h"],
visibility = ["//visibility:public"],
)
cc_library(
name = "eps_copy_input_stream",
srcs = ["upb/wire/eps_copy_input_stream.c"],
hdrs = ["upb/wire/eps_copy_input_stream.h"],
visibility = ["//visibility:public"],
deps = [
":mem",
":port",
],
)
cc_library(
name = "wire_reader",
srcs = [
"upb/wire/internal/swap.h",
"upb/wire/reader.c",
],
hdrs = ["upb/wire/reader.h"],
visibility = ["//visibility:public"],
deps = [
":eps_copy_input_stream",
":port",
":wire_types",
],
)
cc_test(
name = "eps_copy_input_stream_test",
srcs = ["upb/wire/eps_copy_input_stream_test.cc"],
deps = [
":eps_copy_input_stream",
":upb",
"@com_google_googletest//:gtest_main",
],
)
cc_library(
name = "hash",
srcs = [
"upb/hash/common.c",
],
hdrs = [
"upb/hash/common.h",
"upb/hash/int_table.h",
"upb/hash/str_table.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//:__subpackages__"],
deps = [
":base",
":base_internal",
":mem",
":port",
],
)
cc_library(
name = "lex",
srcs = [
"upb/lex/atoi.c",
"upb/lex/round_trip.c",
"upb/lex/strtod.c",
"upb/lex/unicode.c",
],
hdrs = [
"upb/lex/atoi.h",
"upb/lex/round_trip.h",
"upb/lex/strtod.h",
"upb/lex/unicode.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//:__subpackages__"],
deps = [":port"],
)
cc_binary(
name = "libupb.so",
srcs = ["upb/upb_so.c"],
@ -953,9 +786,9 @@ cc_binary(
":message",
":message_accessors",
":message_split64",
":mini_descriptor",
":mini_table",
":port",
"//upb/mini_descriptor",
],
)
@ -971,6 +804,7 @@ upb_amalgamation(
],
libs = [
":base",
":base_internal",
":collections_internal",
":descriptor_upb_proto",
":eps_copy_input_stream",
@ -985,6 +819,11 @@ upb_amalgamation(
":message_rep_internal",
":message_tagged_ptr",
":message_typedef",
":mini_descriptor",
":mini_descriptor_encode_internal",
":mini_descriptor_internal",
":mini_table",
":mini_table_internal",
":port",
":reflection_internal",
":reflection",
@ -992,12 +831,6 @@ upb_amalgamation(
":wire_internal",
":wire_reader",
":wire_types",
"//upb/base:internal",
"//upb/mini_descriptor:encode_internal",
"//upb/mini_descriptor:internal",
"//upb/mini_descriptor:mini_descriptor",
"//upb/mini_table:internal",
"//upb/mini_table:mini_table",
],
strip_import_prefix = ["src"],
)
@ -1018,6 +851,7 @@ upb_amalgamation(
],
libs = [
":base",
":base_internal",
":collections_internal",
":descriptor_upb_proto_reflection",
":descriptor_upb_proto",
@ -1034,6 +868,11 @@ upb_amalgamation(
":message_rep_internal",
":message_tagged_ptr",
":message_typedef",
":mini_descriptor",
":mini_descriptor_encode_internal",
":mini_descriptor_internal",
":mini_table",
":mini_table_internal",
":port",
":reflection_internal",
":reflection",
@ -1041,12 +880,6 @@ upb_amalgamation(
":wire_internal",
":wire_reader",
":wire_types",
"//upb/base:internal",
"//upb/mini_descriptor:encode_internal",
"//upb/mini_descriptor:internal",
"//upb/mini_descriptor:mini_descriptor",
"//upb/mini_table:internal",
"//upb/mini_table:mini_table",
],
prefix = "php-",
strip_import_prefix = ["src"],
@ -1069,6 +902,7 @@ upb_amalgamation(
],
libs = [
":base",
":base_internal",
":collections_internal",
":descriptor_upb_proto",
":eps_copy_input_stream",
@ -1084,6 +918,11 @@ upb_amalgamation(
":message_rep_internal",
":message_tagged_ptr",
":message_typedef",
":mini_descriptor",
":mini_descriptor_encode_internal",
":mini_descriptor_internal",
":mini_table",
":mini_table_internal",
":port",
":reflection_internal",
":reflection",
@ -1091,12 +930,6 @@ upb_amalgamation(
":wire_internal",
":wire_reader",
":wire_types",
"//upb/base:internal",
"//upb/mini_descriptor:encode_internal",
"//upb/mini_descriptor:internal",
"//upb/mini_descriptor:mini_descriptor",
"//upb/mini_table:internal",
"//upb/mini_table:mini_table",
],
prefix = "ruby-",
strip_import_prefix = ["src"],
@ -1160,7 +993,19 @@ filegroup(
# ]),
# kotlin_package = "upb",
# no_string_conversion = ["_upb_MiniTable_Build"],
# strict_enums = ["upb_FieldType"],
# strict_enums = [
# "upb_CType",
# "upb_DecodeStatus",
# "upb_EncodeStatus",
# "upb_FieldType",
# "upb_FindUnknown_Status",
# "upb_GetExtension_Status",
# "upb_GetExtensionAsBytes_Status",
# "upb_Label",
# "upb_MapInsertStatus",
# "upb_UnknownToMessage_Status",
# "upb_WireType",
# ],
# visibility = ["//:__subpackages__"],
# )
#

@ -58,7 +58,10 @@ genrule(
"//bazel:workspace_deps.bzl",
],
outs = ["generated-in/CMakeLists.txt"],
cmd = "$(location :make_cmakelists) $@",
cmd = "$(location :make_cmakelists) " +
"$(location //bazel:workspace_deps.bzl) " +
"$(location //:WORKSPACE) " +
"$(location //:BUILD) $@",
tools = [":make_cmakelists"],
)
@ -89,21 +92,27 @@ make_shell_script(
name = "gen_run_cmake_build",
out = "run_cmake_build.sh",
contents = "set -ex\n" +
"(cd cmake/generated-in && rsync -avR . ..)\n" +
"cd $(dirname $1) && rsync -avR . .. && cd ../..\n" +
"mkdir build && cd build && cmake ../cmake && make -j8 && make test",
)
sh_test(
name = "cmake_build",
srcs = ["run_cmake_build.sh"],
args = ["$(location :gen_cmakelists)"],
data = [
":copy_protos",
":gen_cmakelists",
"//:source_files",
"//upb/base:source_files",
"//upb/collections:source_files",
"//upb/hash:source_files",
"//upb/lex:source_files",
"//upb/mem:source_files",
"//upb/mini_descriptor:source_files",
"//upb/mini_table:source_files",
"//upb/text:source_files",
"//upb/wire:source_files",
"@utf8_range//:utf8_range_srcs",
],
target_compatible_with = select({

@ -408,9 +408,11 @@ def GetDict(obj):
globs = GetDict(converter)
workspace_dict = GetDict(WorkspaceFileFunctions(converter))
exec(open("bazel/workspace_deps.bzl").read(), workspace_dict)
exec(open("WORKSPACE").read(), workspace_dict)
exec(open("BUILD").read(), GetDict(BuildFileFunctions(converter)))
# We take all file paths as command-line arguments to ensure that we can find
# each file regardless of how exactly Bazel was invoked.
exec(open(sys.argv[1]).read(), workspace_dict) # workspace_deps.bzl
exec(open(sys.argv[2]).read(), workspace_dict) # WORKSPACE
exec(open(sys.argv[3]).read(), GetDict(BuildFileFunctions(converter))) # BUILD
with open(sys.argv[1], "w") as f:
with open(sys.argv[4], "w") as f:
f.write(converter.convert())

@ -49,8 +49,9 @@ cc_library(
visibility = ["//visibility:public"],
deps = [
"//:json",
"//:message",
"//:reflection",
"//:textformat",
"//:text",
"//:upb",
"@lua//:liblua",
],
@ -72,6 +73,7 @@ exports_files(["upb.lua"])
cc_test(
name = "test_lua",
srcs = ["main.c"],
args = ["$(location :test_upb.lua)"],
copts = UPB_DEFAULT_COPTS,
data = [
"test_upb.lua",

@ -59,11 +59,22 @@ const char* init =
"bazel-bin/?.lua;"
"bazel-bin/external/com_google_protobuf/src/?.lua;"
"bazel-bin/external/com_google_protobuf/?.lua;"
"bazel-bin/external/com_google_protobuf/?.lua;"
"lua/?.lua"
"lua/?.lua;"
// These additional paths handle the case where this test is invoked from
// the protobuf repo's Bazel workspace.
"external/upb/?.lua;"
"external/upb/third_party/lunit/?.lua;"
"src/?.lua;"
"bazel-bin/external/upb/?.lua;"
"external/upb/lua/?.lua"
"'";
int main(int argc, char** argv) {
if (argc < 2) {
fprintf(stderr, "missing argument with path to .lua file\n");
return 1;
}
int ret = 0;
L = luaL_newstate();
luaL_openlibs(L);
@ -72,8 +83,7 @@ int main(int argc, char** argv) {
lua_pushcfunction(L, luaopen_lupb);
signal(SIGINT, sighandler);
ret = ret || lua_pcall(L, 1, LUA_MULTRET, 0) ||
luaL_dofile(L, "lua/test_upb.lua");
ret = ret || lua_pcall(L, 1, LUA_MULTRET, 0) || luaL_dofile(L, argv[1]);
signal(SIGINT, SIG_DFL);
if (ret) {

@ -29,11 +29,9 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*
* lupb_Message -- Message/Array/Map objects in Lua/C that wrap upb/msg.h
* lupb_Message -- Message/Array/Map objects in Lua/C that wrap upb
*/
#include "upb/msg.h"
#include <float.h>
#include <math.h>
#include <stddef.h>
@ -45,6 +43,7 @@
#include "upb/collections/map.h"
#include "upb/json/decode.h"
#include "upb/json/encode.h"
#include "upb/message/message.h"
#include "upb/port/def.inc"
#include "upb/reflection/message.h"
#include "upb/text/encode.h"

@ -673,7 +673,8 @@ end
function test_foo()
local defpool = upb.DefPool()
local filename = "external/com_google_protobuf/src/google/protobuf/descriptor_proto-descriptor-set.proto.bin"
local file = io.open(filename, "rb") or io.open("bazel-bin/" .. filename, "rb")
local alternate_filename = "src/google/protobuf/descriptor_proto-descriptor-set.proto.bin"
local file = io.open(filename, "rb") or io.open("bazel-bin/" .. filename, "rb") or io.open(alternate_filename, "rb")
assert_not_nil(file)
local descriptor = file:read("*a")
assert_true(#descriptor > 0)

@ -59,7 +59,7 @@
#include <string.h>
#include "lauxlib.h"
#include "upb/msg.h"
#include "upb/message/message.h"
/* Lua compatibility code *****************************************************/

@ -36,7 +36,7 @@
#define UPB_LUA_UPB_H_
#include "lauxlib.h"
#include "upb/msg.h"
#include "upb/message/message.h"
#include "upb/reflection/def.h"
#include "upb/reflection/message.h"

@ -77,6 +77,8 @@ cc_library(
"//:message_promote",
"//:mini_table",
"//:upb",
"//:wire",
"//:wire_internal",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",

@ -42,7 +42,7 @@
#include "protos/repeated_field_iterator.h"
#include "upb/base/string_view.h"
#include "upb/collections/array.h"
#include "upb/collections/array_internal.h"
#include "upb/collections/internal/array.h"
#include "upb/mem/arena.h"
#include "upb/message/copy.h"

@ -242,9 +242,10 @@ py_extension(
"//:message_copy",
"//:port",
"//:reflection",
"//:textformat",
"//:text",
"//:upb",
"//:wire",
"//:wire_internal",
"//:wire_reader",
"//:wire_types",
"//upb/util:compare",

@ -255,10 +255,15 @@ pkg_files(
"//:source_files",
"//python:message_srcs",
"//upb/base:source_files",
"//upb/collections:source_files",
"//upb/hash:source_files",
"//upb/lex:source_files",
"//upb/mem:source_files",
"//upb/mini_descriptor:source_files",
"//upb/mini_table:source_files",
"//upb/text:source_files",
"//upb/util:source_files",
"//upb/wire:source_files",
],
strip_prefix = strip_prefix.from_root(""),
)

@ -0,0 +1,124 @@
# Copyright (c) 2009-2021, Google LLC
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Google LLC nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
cc_library(
name = "collections",
hdrs = [
"array.h",
"map.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":internal",
"//:base",
"//:mem",
"//:port",
],
)
cc_library(
name = "internal",
srcs = [
"array.c",
"map.c",
"map_sorter.c",
],
hdrs = [
"array.h",
"internal/array.h",
"internal/map.h",
"internal/map_sorter.h",
"map.h",
"map_gencode_util.h",
"message_value.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
"//:base",
"//:base_internal",
"//:hash",
"//:mem",
"//:message_internal",
"//:message_rep_internal",
"//:message_tagged_ptr",
"//:mini_table",
"//:port",
],
)
cc_library(
name = "split64",
hdrs = [
"array_split64.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":collections",
"//:port",
],
)
cc_test(
name = "array_test",
srcs = ["array_test.cc"],
deps = [
":collections",
"//:base",
"//:upb",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "map_test",
srcs = ["map_test.cc"],
deps = [
":collections",
"//:base",
"//:upb",
"@com_google_googletest//:gtest_main",
],
)
# begin:github_only
filegroup(
name = "source_files",
srcs = glob(
[
"**/*.c",
"**/*.h",
],
),
visibility = [
"//cmake:__pkg__",
"//python/dist:__pkg__",
]
)
# end:github_only

@ -28,9 +28,9 @@
// (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 <string.h>
#include "upb/collections/internal/array.h"
#include "upb/collections/array_internal.h"
#include <string.h>
// Must be last.
#include "upb/port/def.inc"

@ -29,13 +29,10 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "gtest/gtest.h"
#include "upb/base/descriptor_constants.h"
#include "upb/base/string_view.h"
#include "upb/collections/array.h"
#include "upb/collections/map.h"
#include "upb/upb.hpp"
TEST(CollectionsTest, Arrays) {
TEST(ArrayTest, Resize) {
upb::Arena arena;
upb::Status status;
@ -43,7 +40,9 @@ TEST(CollectionsTest, Arrays) {
EXPECT_TRUE(array);
for (int i = 0; i < 10; i++) {
upb_MessageValue mv = {.int32_val = 3 * i};
upb_MessageValue mv;
mv.int32_val = 3 * i;
upb_Array_Append(array, mv, arena.ptr());
EXPECT_EQ(upb_Array_Size(array), i + 1);
EXPECT_EQ(upb_Array_Get(array, i).int32_val, 3 * i);
@ -63,20 +62,3 @@ TEST(CollectionsTest, Arrays) {
EXPECT_EQ(upb_Array_Get(array, 4).int32_val, 0);
EXPECT_EQ(upb_Array_Get(array, 5).int32_val, 0);
}
TEST(CollectionsTest, MapDeleteRegression) {
upb::Arena arena;
upb_Map* map = upb_Map_New(arena.ptr(), kUpb_CType_Int32, kUpb_CType_String);
upb_MessageValue key = {.int32_val = 0};
const char str[] = "abcde";
upb_MessageValue insert_value = {.str_val = upb_StringView_FromString(str)};
upb_MapInsertStatus st = upb_Map_Insert(map, key, insert_value, arena.ptr());
EXPECT_EQ(kUpb_MapInsertStatus_Inserted, st);
upb_MessageValue delete_value;
bool removed = upb_Map_Delete(map, key, &delete_value);
EXPECT_TRUE(removed);
EXPECT_TRUE(
upb_StringView_IsEqual(insert_value.str_val, delete_value.str_val));
}

@ -28,8 +28,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef UPB_INTERNAL_ARRAY_INTERNAL_H_
#define UPB_INTERNAL_ARRAY_INTERNAL_H_
#ifndef UPB_COLLECTIONS_INTERNAL_ARRAY_H_
#define UPB_COLLECTIONS_INTERNAL_ARRAY_H_
#include <string.h>
@ -135,4 +135,4 @@ UPB_INLINE void _upb_array_detach(const void* msg, size_t ofs) {
#include "upb/port/undef.inc"
#endif /* UPB_INTERNAL_ARRAY_INTERNAL_H_ */
#endif /* UPB_COLLECTIONS_INTERNAL_ARRAY_H_ */

@ -30,8 +30,8 @@
// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
#ifndef UPB_COLLECTIONS_MAP_INTERNAL_H_
#define UPB_COLLECTIONS_MAP_INTERNAL_H_
#ifndef UPB_COLLECTIONS_INTERNAL_MAP_H_
#define UPB_COLLECTIONS_INTERNAL_MAP_H_
#include "upb/base/string_view.h"
#include "upb/collections/map.h"
@ -170,4 +170,4 @@ upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size);
#include "upb/port/undef.inc"
#endif /* UPB_COLLECTIONS_MAP_INTERNAL_H_ */
#endif /* UPB_COLLECTIONS_INTERNAL_MAP_H_ */

@ -30,12 +30,12 @@
// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
#ifndef UPB_COLLECTIONS_MAP_SORTER_INTERNAL_H_
#define UPB_COLLECTIONS_MAP_SORTER_INTERNAL_H_
#ifndef UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_
#define UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_
#include <stdlib.h>
#include "upb/collections/map_internal.h"
#include "upb/collections/internal/map.h"
#include "upb/message/extension_internal.h"
#include "upb/message/internal/map_entry.h"
@ -109,4 +109,4 @@ bool _upb_mapsorter_pushexts(_upb_mapsorter* s,
#include "upb/port/undef.inc"
#endif /* UPB_COLLECTIONS_MAP_SORTER_INTERNAL_H_ */
#endif /* UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ */

@ -32,7 +32,7 @@
#include <string.h>
#include "upb/collections/map_internal.h"
#include "upb/collections/internal/map.h"
#include "upb/mem/arena.h"
// Must be last.

@ -33,7 +33,7 @@
#ifndef UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_
#define UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_
#include "upb/collections/map_internal.h"
#include "upb/collections/internal/map.h"
// Must be last.
#include "upb/port/def.inc"

@ -28,8 +28,9 @@
// (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/collections/internal/map_sorter.h"
#include "upb/base/internal/log2.h"
#include "upb/collections/map_sorter_internal.h"
// Must be last.
#include "upb/port/def.inc"

@ -28,12 +28,28 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This header is deprecated, use upb/message/internal.h instead
// IWYU pragma: private, include "upb/message/internal.h"
#include "gtest/gtest.h"
#include "upb/base/string_view.h"
#include "upb/collections/map.h"
#include "upb/upb.hpp"
#ifndef UPB_MSG_INT_H_
#define UPB_MSG_INT_H_
TEST(MapTest, DeleteRegression) {
upb::Arena arena;
upb_Map* map = upb_Map_New(arena.ptr(), kUpb_CType_Int32, kUpb_CType_String);
#include "upb/message/internal.h"
upb_MessageValue key;
key.int32_val = 0;
#endif /* UPB_MSG_INT_H_ */
upb_MessageValue insert_value;
insert_value.str_val = upb_StringView_FromString("abcde");
upb_MapInsertStatus st = upb_Map_Insert(map, key, insert_value, arena.ptr());
EXPECT_EQ(kUpb_MapInsertStatus_Inserted, st);
upb_MessageValue delete_value;
bool removed = upb_Map_Delete(map, key, &delete_value);
EXPECT_TRUE(removed);
EXPECT_TRUE(
upb_StringView_IsEqual(insert_value.str_val, delete_value.str_val));
}

@ -94,24 +94,25 @@ cc_binary(
"//:json",
"//:port",
"//:reflection",
"//:textformat",
"//:text",
"//:wire",
"//upb/json",
],
)
make_shell_script(
name = "gen_test_conformance_upb",
out = "test_conformance_upb.sh",
contents = "external/com_google_protobuf/conformance/conformance_test_runner" +
" --enforce_recommended" +
" --failure_list upb/conformance/conformance_upb_failures.txt" +
" upb/conformance/conformance_upb",
contents = "$1 --enforce_recommended --failure_list $2 $3",
)
sh_test(
name = "test_conformance_upb",
srcs = ["test_conformance_upb.sh"],
args = [
"$(location @com_google_protobuf//conformance:conformance_test_runner)",
"$(location :conformance_upb_failures.txt)",
"$(location :conformance_upb)",
],
data = [
"conformance_upb_failures.txt",
":conformance_upb",
@ -144,24 +145,25 @@ cc_binary(
"//:json",
"//:port",
"//:reflection",
"//:textformat",
"//:text",
"//:wire",
"//upb/json",
],
)
make_shell_script(
name = "gen_test_conformance_upb_dynamic_minitable",
out = "test_conformance_upb_dynamic_minitable.sh",
contents = "external/com_google_protobuf/conformance/conformance_test_runner" +
" --enforce_recommended" +
" --failure_list upb/conformance/conformance_upb_failures.txt" +
" upb/conformance/conformance_upb_dynamic_minitable",
contents = "$1 --enforce_recommended --failure_list $2 $3",
)
sh_test(
name = "test_conformance_upb_dynamic_minitable",
srcs = ["test_conformance_upb_dynamic_minitable.sh"],
args = [
"$(location @com_google_protobuf//conformance:conformance_test_runner)",
"$(location :conformance_upb_failures.txt)",
"$(location :conformance_upb_dynamic_minitable)",
],
data = [
"conformance_upb_failures.txt",
":conformance_upb_dynamic_minitable",

@ -1,39 +0,0 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google LLC. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This header is deprecated, use upb/wire/decode.h instead
// IWYU pragma: private, include "upb/wire/decode.h"
#ifndef UPB_DECODE_H_
#define UPB_DECODE_H_
#include "upb/wire/decode.h"
#endif /* UPB_DECODE_H_ */

@ -1,39 +0,0 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google LLC. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This header is deprecated, use upb/wire/decode_fast.h instead
// IWYU pragma: private, include "upb/wire/decode_fast.h"
#ifndef UPB_DECODE_FAST_H_
#define UPB_DECODE_FAST_H_
#include "upb/wire/decode_fast.h"
#endif /* UPB_DECODE_FAST_H_ */

@ -1,38 +0,0 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google LLC. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This header is deprecated, use upb/reflection/def.hpp instead
#ifndef UPB_DEF_HPP_
#define UPB_DEF_HPP_
#include "upb/reflection/def.hpp"
#endif // UPB_DEF_HPP_

@ -1,39 +0,0 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google LLC. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This header is deprecated, use upb/wire/encode.h instead
// IWYU pragma: private, include "upb/wire/encode.h"
#ifndef UPB_ENCODE_H_
#define UPB_ENCODE_H_
#include "upb/wire/encode.h"
#endif /* UPB_ENCODE_H_ */

@ -33,7 +33,7 @@
// IWYU pragma: begin_exports
#include "upb/collections/array.h"
#include "upb/collections/array_internal.h"
#include "upb/collections/internal/array.h"
#include "upb/collections/map_gencode_util.h"
#include "upb/collections/message_value.h"
#include "upb/message/accessors.h"

@ -0,0 +1,73 @@
# Copyright (c) 2009-2021, Google LLC
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Google LLC nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
cc_library(
name = "hash",
srcs = [
"common.c",
],
hdrs = [
"common.h",
"int_table.h",
"str_table.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
"//:base",
"//:base_internal",
"//:mem",
"//:port",
],
)
cc_test(
name = "test",
srcs = ["test.cc"],
deps = [
":hash",
"//:port",
"//:upb",
"@com_google_googletest//:gtest_main",
],
)
# begin:github_only
filegroup(
name = "source_files",
srcs = glob(
[
"**/*.c",
"**/*.h",
],
),
visibility = [
"//cmake:__pkg__",
"//python/dist:__pkg__",
]
)
# end:github_only

@ -0,0 +1,71 @@
# Copyright (c) 2009-2021, Google LLC
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Google LLC nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
cc_library(
name = "lex",
srcs = [
"atoi.c",
"round_trip.c",
"strtod.c",
"unicode.c",
],
hdrs = [
"atoi.h",
"round_trip.h",
"strtod.h",
"unicode.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = ["//:port"],
)
cc_test(
name = "atoi_test",
srcs = ["atoi_test.cc"],
deps = [
":lex",
"@com_google_absl//absl/strings",
"@com_google_googletest//:gtest_main",
],
)
# begin:github_only
filegroup(
name = "source_files",
srcs = glob(
[
"**/*.c",
"**/*.h",
],
),
visibility = [
"//cmake:__pkg__",
"//python/dist:__pkg__",
]
)
# end:github_only

@ -51,7 +51,7 @@ cc_library(
"internal/arena.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//:__subpackages__"],
visibility = ["//:__pkg__"],
deps = ["//:port"],
)
@ -77,7 +77,6 @@ filegroup(
"**/*.c",
"**/*.h",
],
exclude = ["arena_test.cc"],
),
visibility = [
"//cmake:__pkg__",

@ -31,7 +31,7 @@
#include "upb/message/accessors.h"
#include "upb/collections/array.h"
#include "upb/collections/array_internal.h"
#include "upb/collections/internal/array.h"
#include "upb/collections/map.h"
#include "upb/message/message.h"
#include "upb/mini_table/field.h"

@ -33,9 +33,9 @@
#include "upb/base/descriptor_constants.h"
#include "upb/collections/array.h"
#include "upb/collections/array_internal.h"
#include "upb/collections/internal/array.h"
#include "upb/collections/internal/map.h"
#include "upb/collections/map.h"
#include "upb/collections/map_internal.h"
#include "upb/message/internal.h"
#include "upb/message/internal/accessors.h"
#include "upb/mini_table/enum.h"

@ -30,9 +30,18 @@
#include "upb/message/copy.h"
#include <stdbool.h>
#include <string.h>
#include "upb/base/descriptor_constants.h"
#include "upb/base/string_view.h"
#include "upb/mem/arena.h"
#include "upb/message/accessors.h"
#include "upb/message/internal.h"
#include "upb/message/message.h"
#include "upb/message/typedef.h"
#include "upb/mini_table/field.h"
#include "upb/mini_table/internal/field.h"
// Must be last.
#include "upb/port/def.inc"
@ -290,20 +299,17 @@ upb_Message* _upb_Message_Copy(upb_Message* dst, const upb_Message* src,
if (unknown_size != 0) {
UPB_ASSERT(ptr);
// Make a copy into destination arena.
void* dst_unknowns = upb_Arena_Malloc(arena, unknown_size);
if (dst_unknowns == NULL) return NULL;
memcpy(dst_unknowns, ptr, unknown_size);
if (!_upb_Message_AddUnknown(dst, dst_unknowns, unknown_size, arena)) {
if (!_upb_Message_AddUnknown(dst, ptr, unknown_size, arena)) {
return NULL;
}
}
return dst;
}
void upb_Message_DeepCopy(upb_Message* dst, const upb_Message* src,
bool upb_Message_DeepCopy(upb_Message* dst, const upb_Message* src,
const upb_MiniTable* mini_table, upb_Arena* arena) {
upb_Message_Clear(dst, mini_table);
_upb_Message_Copy(dst, src, mini_table, arena);
return _upb_Message_Copy(dst, src, mini_table, arena) != NULL;
}
// Deep clones a message using the provided target arena.

@ -57,7 +57,7 @@ upb_Map* upb_Map_DeepClone(const upb_Map* map, upb_CType key_type,
upb_Arena* arena);
// Deep copies the message from src to dst.
void upb_Message_DeepCopy(upb_Message* dst, const upb_Message* src,
bool upb_Message_DeepCopy(upb_Message* dst, const upb_Message* src,
const upb_MiniTable* mini_table, upb_Arena* arena);
#ifdef __cplusplus

@ -36,19 +36,22 @@
#include "upb/message/copy.h"
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <string>
#include <vector>
#include "gtest/gtest.h"
#include "google/protobuf/test_messages_proto2.upb.h"
#include "google/protobuf/test_messages_proto3.upb.h"
#include "upb/base/string_view.h"
#include "upb/collections/array.h"
#include "upb/collections/map.h"
#include "upb/mem/arena.h"
#include "upb/message/accessors.h"
#include "upb/test/test.upb.h"
#include "upb/upb.h"
#include "upb/message/internal.h"
#include "upb/message/message.h"
#include "upb/mini_table/message.h"
#include "upb/wire/encode.h"
namespace {
@ -287,4 +290,55 @@ TEST(GeneratedCode, DeepCloneMessageExtensions) {
upb_StringView_FromString(kTestStr1)));
upb_Arena_Free(arena);
}
TEST(GeneratedCode, DeepCloneMessageWithUnknowns) {
upb_Arena* source_arena = upb_Arena_New();
upb_Arena* unknown_arena = upb_Arena_New();
protobuf_test_messages_proto2_TestAllTypesProto2* msg =
protobuf_test_messages_proto2_TestAllTypesProto2_new(source_arena);
ASSERT_TRUE(
protobuf_test_messages_proto2_TestAllTypesProto2_map_int32_double_set(
msg, 12, 1200.5, source_arena));
ASSERT_TRUE(
protobuf_test_messages_proto2_TestAllTypesProto2_map_string_string_set(
msg, upb_StringView_FromString("key1"),
upb_StringView_FromString("value1"), source_arena));
// Create unknown data.
protobuf_test_messages_proto2_UnknownToTestAllTypes* unknown_source =
protobuf_test_messages_proto2_UnknownToTestAllTypes_new(unknown_arena);
protobuf_test_messages_proto2_UnknownToTestAllTypes_set_optional_bool(
unknown_source, true);
protobuf_test_messages_proto2_UnknownToTestAllTypes_set_optional_int32(
unknown_source, 123);
// Encode unknown message to bytes.
size_t len;
char* data;
upb_Arena* encode_arena = upb_Arena_New();
upb_EncodeStatus status =
upb_Encode(unknown_source,
&protobuf_test_messages_proto2_UnknownToTestAllTypes_msg_init,
kUpb_EncodeOption_CheckRequired, encode_arena, &data, &len);
ASSERT_EQ(status, kUpb_EncodeStatus_Ok);
std::string unknown_data(data, len);
// Add unknown data.
_upb_Message_AddUnknown(msg, data, len, source_arena);
// Create clone.
upb_Arena* clone_arena = upb_Arena_New();
protobuf_test_messages_proto2_TestAllTypesProto2* clone =
(protobuf_test_messages_proto2_TestAllTypesProto2*)upb_Message_DeepClone(
msg, &protobuf_test_messages_proto2_TestAllTypesProto2_msg_init,
clone_arena);
upb_Arena_Free(source_arena);
upb_Arena_Free(unknown_arena);
upb_Arena_Free(encode_arena);
// Read unknown data from clone and verify.
size_t cloned_length;
const char* cloned_unknown_data =
upb_Message_GetUnknown(clone, &cloned_length);
EXPECT_EQ(cloned_length, len);
EXPECT_EQ(memcmp(cloned_unknown_data, unknown_data.c_str(), cloned_length),
0);
upb_Arena_Free(clone_arena);
}
} // namespace

@ -31,7 +31,7 @@
#ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_
#define UPB_MESSAGE_INTERNAL_ACCESSORS_H_
#include "upb/collections/map_internal.h"
#include "upb/collections/internal/map.h"
#include "upb/message/extension_internal.h"
#include "upb/message/internal.h"
#include "upb/mini_table/internal/field.h"

@ -31,7 +31,7 @@
#include "upb/message/promote.h"
#include "upb/collections/array.h"
#include "upb/collections/array_internal.h"
#include "upb/collections/internal/array.h"
#include "upb/collections/map.h"
#include "upb/message/accessors.h"
#include "upb/message/message.h"

@ -5,45 +5,45 @@ load(
)
cc_library(
name = "internal",
name = "mini_descriptor",
srcs = [
"internal/base92.c",
"build_enum.c",
"decode.c",
"link.c",
],
hdrs = [
"internal/base92.h",
"internal/decoder.h",
"internal/modifiers.h",
"internal/wire_constants.h",
"build_enum.h",
"decode.h",
"link.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//:__subpackages__"],
visibility = ["//visibility:public"],
deps = [
":internal",
"//:base",
"//:base_internal",
"//:mem",
"//:mini_table",
"//:mini_table_internal",
"//:port",
],
)
cc_library(
name = "mini_descriptor",
name = "internal",
srcs = [
"build_enum.c",
"decode.c",
"link.c",
"internal/base92.c",
],
hdrs = [
"build_enum.h",
"decode.h",
"link.h",
"internal/base92.h",
"internal/decoder.h",
"internal/modifiers.h",
"internal/wire_constants.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//:friends"],
visibility = ["//visibility:public"],
deps = [
":internal",
"//:base",
"//:mem",
"//:mini_table",
"//:mini_table_internal",
"//:base_internal",
"//:port",
],
)
@ -58,7 +58,7 @@ cc_library(
"internal/encode.hpp",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//:__subpackages__"],
visibility = ["//visibility:public"],
deps = [
":internal",
"//:base",
@ -75,10 +75,11 @@ cc_test(
":encode_internal",
":internal",
":mini_descriptor",
"@com_google_absl//absl/container:flat_hash_set",
"//:upb",
"//:message_accessors_internal",
"//:mini_table",
"//:upb",
"//:wire",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_googletest//:gtest_main",
"@com_google_protobuf//:protobuf",
],

@ -48,7 +48,6 @@ cc_library(
deps = [
":internal",
"//:base",
"//:base_internal",
"//:hash",
"//:mem",
"//:message_typedef",
@ -72,7 +71,6 @@ cc_library(
visibility = ["//visibility:public"],
deps = [
"//:base",
"//:base_internal",
"//:message_typedef",
"//:port",
],
@ -86,7 +84,6 @@ filegroup(
"**/*.c",
"**/*.h",
],
exclude = ["encode_test.cc"],
),
visibility = [
"//cmake:__pkg__",

@ -1,39 +0,0 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google LLC. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This header is deprecated, use upb/message/message.h instead
// IWYU pragma: private, include "upb/message/message.h"
#ifndef UPB_MSG_H_
#define UPB_MSG_H_
#include "upb/message/message.h"
#endif /* UPB_MSG_INT_H_ */

@ -139,10 +139,10 @@ cc_library(
visibility = ["//:__subpackages__"],
deps = [
"//:upb",
"//:mini_descriptor",
"//:mini_table",
"//:mini_table_internal",
"//:port",
"//upb/mini_descriptor",
],
)
@ -171,7 +171,6 @@ cc_test(
"//:json",
"//:port",
"//:reflection",
"//upb/json",
"@com_google_googletest//:gtest_main",
],
)
@ -188,6 +187,7 @@ cc_test(
":test_upb_proto",
"//:upb",
"//:base",
"//:collections",
"//:mem",
"//:port",
"@com_google_googletest//:gtest_main",

@ -0,0 +1,64 @@
# Copyright (c) 2009-2021, Google LLC
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Google LLC nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
cc_library(
name = "text",
srcs = [
"encode.c",
],
hdrs = [
"encode.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
"//:collections_internal",
"//:eps_copy_input_stream",
"//:lex",
"//:port",
"//:reflection",
"//:wire",
"//:wire_reader",
"//:wire_types",
],
)
# begin:github_only
filegroup(
name = "source_files",
srcs = glob(
[
"**/*.c",
"**/*.h",
],
),
visibility = [
"//cmake:__pkg__",
"//python/dist:__pkg__",
]
)
# end:github_only

@ -36,8 +36,8 @@
#include <stdarg.h>
#include <string.h>
#include "upb/collections/internal/map_sorter.h"
#include "upb/collections/map.h"
#include "upb/collections/map_sorter_internal.h"
#include "upb/lex/round_trip.h"
#include "upb/port/vsnprintf_compat.h"
#include "upb/reflection/message.h"

@ -0,0 +1,135 @@
# Copyright (c) 2009-2021, Google LLC
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Google LLC nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load("//bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
cc_library(
name = "wire",
hdrs = [
"decode.h",
"encode.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":internal",
"//:mem",
"//:message_internal",
"//:mini_table",
"//:port",
],
)
cc_library(
name = "internal",
srcs = [
"decode.c",
"decode_fast.c",
"encode.c",
],
hdrs = [
"common.h",
"decode.h",
"decode_fast.h",
"encode.h",
"internal/common.h",
"internal/decode.h",
"internal/swap.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":eps_copy_input_stream",
":reader",
":types",
"//:base",
"//:collections_internal",
"//:mem_internal",
"//:message_accessors_internal",
"//:message_internal",
"//:message_rep_internal",
"//:mini_table",
"//:port",
"@utf8_range",
],
)
cc_library(
name = "reader",
srcs = [
"internal/swap.h",
"reader.c",
],
hdrs = ["reader.h"],
visibility = ["//visibility:public"],
deps = [
":eps_copy_input_stream",
":types",
"//:port",
],
)
cc_library(
name = "types",
hdrs = ["types.h"],
visibility = ["//visibility:public"],
)
cc_library(
name = "eps_copy_input_stream",
srcs = ["eps_copy_input_stream.c"],
hdrs = ["eps_copy_input_stream.h"],
visibility = ["//visibility:public"],
deps = [
"//:mem",
"//:port",
],
)
cc_test(
name = "eps_copy_input_stream_test",
srcs = ["eps_copy_input_stream_test.cc"],
deps = [
":eps_copy_input_stream",
"//:upb",
"@com_google_googletest//:gtest_main",
],
)
# begin:github_only
filegroup(
name = "source_files",
srcs = glob(
[
"**/*.c",
"**/*.h",
],
),
visibility = [
"//cmake:__pkg__",
"//python/dist:__pkg__",
]
)
# end:github_only

@ -33,8 +33,8 @@
#include <string.h>
#include "upb/base/descriptor_constants.h"
#include "upb/collections/array_internal.h"
#include "upb/collections/map_internal.h"
#include "upb/collections/internal/array.h"
#include "upb/collections/internal/map.h"
#include "upb/mem/internal/arena.h"
#include "upb/message/internal/accessors.h"
#include "upb/message/internal/map_entry.h"

@ -40,7 +40,7 @@
#include "upb/wire/decode_fast.h"
#include "upb/collections/array_internal.h"
#include "upb/collections/internal/array.h"
#include "upb/wire/internal/decode.h"
// Must be last.

@ -34,8 +34,8 @@
#include <string.h>
#include "upb/collections/array_internal.h"
#include "upb/collections/map_sorter_internal.h"
#include "upb/collections/internal/array.h"
#include "upb/collections/internal/map_sorter.h"
#include "upb/message/extension_internal.h"
#include "upb/message/internal/accessors.h"
#include "upb/mini_table/sub.h"

@ -130,11 +130,11 @@ bootstrap_cc_library(
copts = UPB_DEFAULT_CPPOPTS,
visibility = ["//protos_generator:__pkg__"],
deps = [
"//:mini_descriptor",
"//:mini_table",
"//:mini_table_internal",
"//:port",
"//:upb",
"//upb/mini_descriptor",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/strings",
],
@ -231,13 +231,12 @@ cc_library(
"//:descriptor_upb_proto",
"//:json",
"//:mem",
"//:mini_descriptor",
"//:mini_table",
"//:port",
"//:reflection",
"//:reflection_internal",
"//:wire",
"//upb/json",
"//upb/mini_descriptor",
],
)

@ -20,7 +20,7 @@ _upbc_base = "//upbc:protoc-gen-upb"
# begin:github_only
_is_google3 = False
_extra_proto_path = "-Iexternal/com_google_protobuf/src "
_extra_proto_path = "-I$$(dirname $(location @com_google_protobuf//:descriptor_proto_srcs))/../.. "
# end:github_only
def _upbc(stage):

Loading…
Cancel
Save