Skip to content

Commit

Permalink
upb: use the new reflection headers
Browse files Browse the repository at this point in the history
Reflection headers now live in upb/reflection/ so update our include statements to
reflect this. (See what I did there?)

PiperOrigin-RevId: 474596615
  • Loading branch information
ericsalo authored and copybara-github committed Sep 15, 2022
1 parent 38d8430 commit edecfd5
Show file tree
Hide file tree
Showing 36 changed files with 63 additions and 46 deletions.
18 changes: 17 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -326,15 +326,31 @@ cc_library(

cc_library(
name = "generated_reflection_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
srcs = [
"upb/reflection/common.h",
"upb/reflection/def_pool.h",
"upb/reflection/def_type.h",
"upb/reflection/enum_def.h",
"upb/reflection/enum_value_def.h",
"upb/reflection/extension_range.h",
"upb/reflection/field_def.h",
"upb/reflection/file_def.h",
"upb/reflection/message_def.h",
"upb/reflection/method_def.h",
"upb/reflection/oneof_def.h",
"upb/reflection/service_def.h",
],
hdrs = [
"upb/def.h",
"upb/port_def.inc",
"upb/port_undef.inc",
"upb/reflection/def.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":descriptor_upb_proto",
":reflection",
":table_internal",
],
)

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "benchmarks/descriptor.upb.h"
#include "benchmarks/descriptor.upbdefs.h"
#include "benchmarks/descriptor_sv.pb.h"
#include "upb/def.hpp"
#include "upb/reflection/def.hpp"

upb_StringView descriptor = benchmarks_descriptor_proto_upbdefinit.descriptor;
namespace protobuf = ::google::protobuf;
Expand Down
2 changes: 1 addition & 1 deletion python/convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "python/message.h"
#include "python/protobuf.h"
#include "upb/map.h"
#include "upb/reflection.h"
#include "upb/reflection/message.h"
#include "upb/util/compare.h"

// Must be last.
Expand Down
4 changes: 2 additions & 2 deletions python/convert.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#define PYUPB_CONVERT_H__

#include "protobuf.h"
#include "upb/def.h"
#include "upb/reflection.h"
#include "upb/reflection/def.h"
#include "upb/reflection/message.h"

// Converts `val` to a Python object according to the type information in `f`.
// Any newly-created Python objects that reference non-primitive data from `val`
Expand Down
2 changes: 1 addition & 1 deletion python/descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "python/descriptor_pool.h"
#include "python/message.h"
#include "python/protobuf.h"
#include "upb/def.h"
#include "upb/reflection/def.h"
#include "upb/util/def_to_proto.h"

// -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion python/descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <stdbool.h>

#include "python/python_api.h"
#include "upb/def.h"
#include "upb/reflection/def.h"

typedef enum {
kPyUpb_Descriptor = 0,
Expand Down
2 changes: 1 addition & 1 deletion python/descriptor_containers.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include "python/descriptor.h"
#include "python/protobuf.h"
#include "upb/def.h"
#include "upb/reflection/def.h"

// Implements __repr__ as str(dict(self)).
static PyObject* PyUpb_DescriptorMap_Repr(PyObject* _self) {
Expand Down
2 changes: 1 addition & 1 deletion python/descriptor_containers.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include <stdbool.h>

#include "protobuf.h"
#include "upb/def.h"
#include "upb/reflection/def.h"

// -----------------------------------------------------------------------------
// PyUpb_GenericSequence
Expand Down
2 changes: 1 addition & 1 deletion python/descriptor_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "python/descriptor.h"
#include "python/message.h"
#include "python/protobuf.h"
#include "upb/def.h"
#include "upb/reflection/def.h"
#include "upb/util/def_to_proto.h"

// -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion python/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
#include "python/convert.h"
#include "python/message.h"
#include "python/protobuf.h"
#include "upb/def.h"
#include "upb/map.h"
#include "upb/reflection/def.h"

// -----------------------------------------------------------------------------
// MapContainer
Expand Down
2 changes: 1 addition & 1 deletion python/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <stdbool.h>

#include "python/python_api.h"
#include "upb/def.h"
#include "upb/reflection/def.h"

// Creates a new repeated field stub for field `f` of message object `parent`.
// Precondition: `parent` must be a stub.
Expand Down
4 changes: 2 additions & 2 deletions python/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#include "python/extension_dict.h"
#include "python/map.h"
#include "python/repeated.h"
#include "upb/def.h"
#include "upb/reflection.h"
#include "upb/reflection/def.h"
#include "upb/reflection/message.h"
#include "upb/text_encode.h"
#include "upb/util/required_fields.h"

Expand Down
2 changes: 1 addition & 1 deletion python/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <stdbool.h>

#include "python/protobuf.h"
#include "upb/reflection.h"
#include "upb/reflection/message.h"

// Removes the wrapper object for this field from the unset subobject cache.
void PyUpb_Message_CacheDelete(PyObject* _self, const upb_FieldDef* f);
Expand Down
2 changes: 1 addition & 1 deletion python/repeated.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <stdbool.h>

#include "python/python_api.h"
#include "upb/def.h"
#include "upb/reflection/def.h"

// Creates a new repeated field stub for field `f` of message object `parent`.
// Precondition: `parent` must be a stub.
Expand Down
2 changes: 1 addition & 1 deletion upb/bindings/lua/def.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "upb/def.h"
#include "upb/reflection/def.h"

#include <float.h>
#include <math.h>
Expand Down
2 changes: 1 addition & 1 deletion upb/bindings/lua/msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "upb/json_encode.h"
#include "upb/map.h"
#include "upb/port_def.inc"
#include "upb/reflection.h"
#include "upb/reflection/message.h"
#include "upb/text_encode.h"

/*
Expand Down
4 changes: 2 additions & 2 deletions upb/bindings/lua/upb.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
#define UPB_LUA_UPB_H_

#include "lauxlib.h"
#include "upb/def.h"
#include "upb/msg.h"
#include "upb/reflection.h"
#include "upb/reflection/def.h"
#include "upb/reflection/message.h"

/* Lua changes its API in incompatible ways in every minor release.
* This is some shim code to paper over the differences. */
Expand Down
2 changes: 1 addition & 1 deletion upb/conformance_upb.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "upb/encode.h"
#include "upb/json_decode.h"
#include "upb/json_encode.h"
#include "upb/reflection.h"
#include "upb/reflection/message.h"
#include "upb/text_encode.h"

// Must be last.
Expand Down
2 changes: 1 addition & 1 deletion upb/json_decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "upb/internal/atoi.h"
#include "upb/internal/unicode.h"
#include "upb/map.h"
#include "upb/reflection.h"
#include "upb/reflection/message.h"

// Must be last.
#include "upb/port_def.inc"
Expand Down
2 changes: 1 addition & 1 deletion upb/json_decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#ifndef UPB_JSONDECODE_H_
#define UPB_JSONDECODE_H_

#include "upb/def.h"
#include "upb/reflection/def.h"

// Must be last.
#include "upb/port_def.inc"
Expand Down
2 changes: 1 addition & 1 deletion upb/json_decode_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@

#include "google/protobuf/struct.upb.h"
#include "gtest/gtest.h"
#include "upb/def.hpp"
#include "upb/json_test.upb.h"
#include "upb/json_test.upbdefs.h"
#include "upb/reflection/def.hpp"
#include "upb/upb.hpp"

static upb_test_Box* JsonDecode(const char* json, upb_Arena* a) {
Expand Down
2 changes: 1 addition & 1 deletion upb/json_encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "upb/internal/encode.h"
#include "upb/internal/vsnprintf_compat.h"
#include "upb/map.h"
#include "upb/reflection.h"
#include "upb/reflection/message.h"

// Must be last.
#include "upb/port_def.inc"
Expand Down
2 changes: 1 addition & 1 deletion upb/json_encode.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#ifndef UPB_JSONENCODE_H_
#define UPB_JSONENCODE_H_

#include "upb/def.h"
#include "upb/reflection/def.h"

// Must be last.
#include "upb/port_def.inc"
Expand Down
5 changes: 3 additions & 2 deletions upb/json_encode_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "upb/json_encode.h"

#include "google/protobuf/struct.upb.h"
#include "gtest/gtest.h"
#include "upb/def.hpp"
#include "upb/json_encode.h"
#include "upb/json_test.upb.h"
#include "upb/json_test.upbdefs.h"
#include "upb/reflection/def.hpp"
#include "upb/upb.hpp"

static std::string JsonEncode(const upb_test_Box* msg, int options) {
Expand Down
2 changes: 1 addition & 1 deletion upb/msg_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "google/protobuf/test_messages_proto3.upb.h"
#include "upb/def.hpp"
#include "upb/fuzz_test_util.h"
#include "upb/json_decode.h"
#include "upb/json_encode.h"
#include "upb/msg_test.upb.h"
#include "upb/msg_test.upbdefs.h"
#include "upb/reflection/def.hpp"
#include "upb/upb.hpp"

// begin:google_only
Expand Down
4 changes: 2 additions & 2 deletions upb/test_cpp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
#include "google/protobuf/timestamp.upb.h"
#include "google/protobuf/timestamp.upbdefs.h"
#include "gtest/gtest.h"
#include "upb/def.h"
#include "upb/def.hpp"
#include "upb/json_decode.h"
#include "upb/json_encode.h"
#include "upb/reflection/def.h"
#include "upb/reflection/def.hpp"
#include "upb/test_cpp.upb.h"
#include "upb/test_cpp.upbdefs.h"
#include "upb/upb.h"
Expand Down
2 changes: 1 addition & 1 deletion upb/text_encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "upb/internal/encode.h"
#include "upb/internal/vsnprintf_compat.h"
#include "upb/map.h"
#include "upb/reflection.h"
#include "upb/reflection/message.h"

// Must be last.
#include "upb/port_def.inc"
Expand Down
2 changes: 1 addition & 1 deletion upb/text_encode.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#ifndef UPB_TEXTENCODE_H_
#define UPB_TEXTENCODE_H_

#include "upb/def.h"
#include "upb/reflection/def.h"

// Must be last.
#include "upb/port_def.inc"
Expand Down
2 changes: 1 addition & 1 deletion upb/util/compare.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#ifndef UPB_UTIL_COMPARE_H_
#define UPB_UTIL_COMPARE_H_

#include "upb/def.h"
#include "upb/reflection/def.h"

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion upb/util/def_to_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <stdio.h>

#include "upb/internal/vsnprintf_compat.h"
#include "upb/reflection.h"
#include "upb/reflection/message.h"

/* Must be last. */
#include "upb/port_def.inc"
Expand Down
2 changes: 1 addition & 1 deletion upb/util/def_to_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#ifndef UPB_UTIL_DEF_TO_PROTO_H_
#define UPB_UTIL_DEF_TO_PROTO_H_

#include "upb/def.h"
#include "upb/reflection/def.h"

#ifdef __cplusplus
extern "C" {
Expand Down
4 changes: 2 additions & 2 deletions upb/util/def_to_proto_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@

#include "upb/util/def_to_proto.h"

#include "gmock/gmock.h"
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/descriptor.upbdefs.h"
#include "google/protobuf/dynamic_message.h"
#include "google/protobuf/util/message_differencer.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "upb/def.hpp"
#include "upb/reflection/def.hpp"
#include "upb/upb.hpp"
#include "upb/util/def_to_proto_test.upbdefs.h"

Expand Down
2 changes: 1 addition & 1 deletion upb/util/required_fields.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "upb/internal/vsnprintf_compat.h"
#include "upb/map.h"
#include "upb/reflection.h"
#include "upb/reflection/message.h"

// Must be last.
#include "upb/port_def.inc"
Expand Down
4 changes: 2 additions & 2 deletions upb/util/required_fields.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#ifndef UPB_UTIL_REQUIRED_FIELDS_H_
#define UPB_UTIL_REQUIRED_FIELDS_H_

#include "upb/def.h"
#include "upb/reflection.h"
#include "upb/reflection/def.h"
#include "upb/reflection/message.h"

/* Must be last. */
#include "upb/port_def.inc"
Expand Down
4 changes: 2 additions & 2 deletions upb/util/required_fields_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@

#include "upb/util/required_fields.h"

#include "absl/strings/string_view.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "upb/def.hpp"
#include "absl/strings/string_view.h"
#include "upb/json_decode.h"
#include "upb/reflection/def.hpp"
#include "upb/upb.hpp"
#include "upb/util/required_fields_test.upb.h"
#include "upb/util/required_fields_test.upbdefs.h"
Expand Down
Loading

0 comments on commit edecfd5

Please sign in to comment.