From d9b6f13cde8b3f3ca81740174e391c1ac3116717 Mon Sep 17 00:00:00 2001 From: Eric Salo Date: Thu, 3 Nov 2022 11:35:20 -0700 Subject: [PATCH] remove upb_MtDataEncoder from the public surface PiperOrigin-RevId: 485928803 --- BUILD | 5 +++-- upb/mini_table.h | 1 - upb/mini_table/accessors_test.cc | 2 +- upb/mini_table/encode.c | 3 +-- upb/mini_table/{encode.h => encode_internal.h} | 6 +++--- upb/{mini_table.hpp => mini_table/encode_internal.hpp} | 9 ++++----- upb/mini_table/encode_test.cc | 2 +- upb/reflection/desc_state_internal.h | 2 +- upb/reflection/enum_def.c | 1 - upb/reflection/field_def.c | 1 - upbc/BUILD | 2 ++ upbc/file_layout.cc | 2 +- upbc/file_layout.h | 3 ++- upbc/protoc-gen-upb.cc | 2 +- 14 files changed, 20 insertions(+), 21 deletions(-) rename upb/mini_table/{encode.h => encode_internal.h} (97%) rename upb/{mini_table.hpp => mini_table/encode_internal.hpp} (95%) diff --git a/BUILD b/BUILD index 813e7e20ff..7d53398aae 100644 --- a/BUILD +++ b/BUILD @@ -181,6 +181,8 @@ cc_library( ], hdrs = [ "upb/mini_table/common_internal.h", + "upb/mini_table/encode_internal.h", + "upb/mini_table/encode_internal.hpp", ], visibility = ["//:__subpackages__"], deps = [ @@ -199,13 +201,12 @@ cc_library( "upb/mini_table/common_internal.h", "upb/mini_table/decode.c", "upb/mini_table/encode.c", + "upb/mini_table/encode_internal.h", "upb/msg_internal.h", ], hdrs = [ "upb/mini_table.h", - "upb/mini_table.hpp", "upb/mini_table/decode.h", - "upb/mini_table/encode.h", ], copts = UPB_DEFAULT_COPTS, visibility = ["//visibility:public"], diff --git a/upb/mini_table.h b/upb/mini_table.h index d5a4d6898b..e0dc2ea9d8 100644 --- a/upb/mini_table.h +++ b/upb/mini_table.h @@ -31,6 +31,5 @@ #define UPB_MINI_TABLE_H_ #include "upb/mini_table/decode.h" -#include "upb/mini_table/encode.h" #endif /* UPB_MINI_TABLE_H_ */ diff --git a/upb/mini_table/accessors_test.cc b/upb/mini_table/accessors_test.cc index 7b1f3aaf4b..eb0c3fae6f 100644 --- a/upb/mini_table/accessors_test.cc +++ b/upb/mini_table/accessors_test.cc @@ -38,7 +38,7 @@ #include "google/protobuf/test_messages_proto3.upb.h" #include "upb/array.h" #include "upb/mini_table/decode.h" -#include "upb/mini_table/encode.h" +#include "upb/mini_table/encode_internal.h" #include "upb/test.upb.h" #include "upb/upb.h" #include "upb/wire/decode.h" diff --git a/upb/mini_table/encode.c b/upb/mini_table/encode.c index 61fa5e7c0f..a386e6fb3f 100644 --- a/upb/mini_table/encode.c +++ b/upb/mini_table/encode.c @@ -25,13 +25,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "upb/mini_table/encode.h" - #include #include "upb/mem/arena.h" #include "upb/mini_table/common.h" #include "upb/mini_table/common_internal.h" +#include "upb/mini_table/encode_internal.h" #include "upb/upb.h" // Must be last. diff --git a/upb/mini_table/encode.h b/upb/mini_table/encode_internal.h similarity index 97% rename from upb/mini_table/encode.h rename to upb/mini_table/encode_internal.h index 4ef23d12cc..6cc7d5a309 100644 --- a/upb/mini_table/encode.h +++ b/upb/mini_table/encode_internal.h @@ -25,8 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef UPB_MINI_TABLE_ENCODE_H_ -#define UPB_MINI_TABLE_ENCODE_H_ +#ifndef UPB_MINI_TABLE_ENCODE_INTERNAL_H_ +#define UPB_MINI_TABLE_ENCODE_INTERNAL_H_ #include "upb/mini_table/common.h" @@ -106,4 +106,4 @@ char* upb_MtDataEncoder_EncodeMessageSet(upb_MtDataEncoder* e, char* ptr); #include "upb/port_undef.inc" -#endif /* UPB_MINI_TABLE_ENCODE_H_ */ +#endif /* UPB_MINI_TABLE_ENCODE_INTERNAL_H_ */ diff --git a/upb/mini_table.hpp b/upb/mini_table/encode_internal.hpp similarity index 95% rename from upb/mini_table.hpp rename to upb/mini_table/encode_internal.hpp index 7e1a5c3f23..c8bea3ea55 100644 --- a/upb/mini_table.hpp +++ b/upb/mini_table/encode_internal.hpp @@ -25,13 +25,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef UPB_MINI_TABLE_HPP_ -#define UPB_MINI_TABLE_HPP_ +#ifndef UPB_MINI_TABLE_ENCODE_INTERNAL_HPP_ +#define UPB_MINI_TABLE_ENCODE_INTERNAL_HPP_ #include -#include "upb/mini_table/decode.h" -#include "upb/mini_table/encode.h" +#include "upb/mini_table/encode_internal.h" namespace upb { @@ -133,4 +132,4 @@ class MtDataEncoder { } // namespace upb -#endif /* UPB_MINI_TABLE_HPP_ */ +#endif /* UPB_MINI_TABLE_ENCODE_INTERNAL_HPP_ */ diff --git a/upb/mini_table/encode_test.cc b/upb/mini_table/encode_test.cc index d607aba274..f66a766622 100644 --- a/upb/mini_table/encode_test.cc +++ b/upb/mini_table/encode_test.cc @@ -29,9 +29,9 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" #include "absl/container/flat_hash_set.h" -#include "upb/mini_table.hpp" #include "upb/mini_table/common_internal.h" #include "upb/mini_table/decode.h" +#include "upb/mini_table/encode_internal.hpp" #include "upb/upb.h" #include "upb/upb.hpp" #include "upb/wire/decode.h" diff --git a/upb/reflection/desc_state_internal.h b/upb/reflection/desc_state_internal.h index 157a274def..e4cf4ee2f9 100644 --- a/upb/reflection/desc_state_internal.h +++ b/upb/reflection/desc_state_internal.h @@ -28,7 +28,7 @@ #ifndef UPB_REFLECTION_DESC_STATE_INTERNAL_H_ #define UPB_REFLECTION_DESC_STATE_INTERNAL_H_ -#include "upb/mini_table/encode.h" +#include "upb/mini_table/encode_internal.h" // Must be last. #include "upb/port_def.inc" diff --git a/upb/reflection/enum_def.c b/upb/reflection/enum_def.c index f54141b698..fc9f217e2e 100644 --- a/upb/reflection/enum_def.c +++ b/upb/reflection/enum_def.c @@ -28,7 +28,6 @@ #include #include "upb/mini_table/decode.h" -#include "upb/mini_table/encode.h" #include "upb/reflection/def_builder_internal.h" #include "upb/reflection/def_type.h" #include "upb/reflection/desc_state_internal.h" diff --git a/upb/reflection/field_def.c b/upb/reflection/field_def.c index b85e7b1ece..a0f83598d7 100644 --- a/upb/reflection/field_def.c +++ b/upb/reflection/field_def.c @@ -29,7 +29,6 @@ #include #include "upb/mini_table/decode.h" -#include "upb/mini_table/encode.h" #include "upb/reflection/def_builder_internal.h" #include "upb/reflection/def_pool.h" #include "upb/reflection/def_type.h" diff --git a/upbc/BUILD b/upbc/BUILD index c77740789c..a68057ded9 100644 --- a/upbc/BUILD +++ b/upbc/BUILD @@ -95,6 +95,7 @@ cc_library( deps = [ ":common", "//:mini_table", + "//:mini_table_internal", "//:upb", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/strings", @@ -142,6 +143,7 @@ cc_binary( ":file_layout", ":names", "//:mini_table", + "//:mini_table_internal", "//:port", "//:upb", "@com_google_absl//absl/base:core_headers", diff --git a/upbc/file_layout.cc b/upbc/file_layout.cc index 5f1ea660e7..57be235082 100644 --- a/upbc/file_layout.cc +++ b/upbc/file_layout.cc @@ -28,7 +28,7 @@ #include #include -#include "upb/mini_table.hpp" +#include "upb/mini_table/encode_internal.hpp" #include "upbc/common.h" namespace upbc { diff --git a/upbc/file_layout.h b/upbc/file_layout.h index 3dd809cba6..6804cdc162 100644 --- a/upbc/file_layout.h +++ b/upbc/file_layout.h @@ -30,7 +30,8 @@ #include "google/protobuf/descriptor.pb.h" #include "absl/container/flat_hash_map.h" #include "absl/strings/substitute.h" -#include "upb/mini_table.hpp" +#include "upb/mini_table/decode.h" +#include "upb/mini_table/encode_internal.hpp" #include "upb/upb.hpp" namespace upbc { diff --git a/upbc/protoc-gen-upb.cc b/upbc/protoc-gen-upb.cc index d466503d03..9def06b0c0 100644 --- a/upbc/protoc-gen-upb.cc +++ b/upbc/protoc-gen-upb.cc @@ -33,7 +33,7 @@ #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" #include "absl/strings/substitute.h" -#include "upb/mini_table.hpp" +#include "upb/mini_table/encode_internal.hpp" #include "upbc/common.h" #include "upbc/file_layout.h" #include "upbc/names.h"