clean up the dependency graph some more

PiperOrigin-RevId: 456890270
pull/13171/head
Protobuf Team Bot 2 years ago committed by Copybara-Service
parent 1695cb2788
commit 7975945e61
  1. 3
      BUILD
  2. 1
      upb/array.c
  3. 1
      upb/array.h
  4. 1
      upb/def.c
  5. 1
      upb/map.c
  6. 1
      upb/map.h
  7. 12
      upb/message_value.h
  8. 2
      upb/mini_table_accessors.c
  9. 10
      upb/msg.h
  10. 8
      upb/msg_internal.h
  11. 5
      upb/upb.h

@ -169,7 +169,6 @@ cc_library(
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":descriptor_upb_proto",
":mini_table",
":port",
":reflection",
@ -345,6 +344,7 @@ cc_library(
srcs = [
"upb/array.c",
"upb/map.c",
"upb/msg_internal.h",
],
hdrs = [
"upb/array.h",
@ -355,7 +355,6 @@ cc_library(
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":descriptor_upb_proto",
":mini_table",
":port",
":table",

@ -30,6 +30,7 @@
#include <string.h>
#include "upb/msg.h"
#include "upb/msg_internal.h"
// Must be last.
#include "upb/port_def.inc"

@ -29,6 +29,7 @@
#define UPB_ARRAY_H_
#include "upb/message_value.h"
#include "upb/upb.h"
// Must be last.
#include "upb/port_def.inc"

@ -33,7 +33,6 @@
#include <stdlib.h>
#include <string.h>
#include "google/protobuf/descriptor.upb.h"
#include "upb/mini_table.h"
#include "upb/reflection.h"

@ -30,6 +30,7 @@
#include <string.h>
#include "upb/msg.h"
#include "upb/msg_internal.h"
// Must be last.
#include "upb/port_def.inc"

@ -29,6 +29,7 @@
#define UPB_MAP_H_
#include "upb/message_value.h"
#include "upb/upb.h"
// Must be last.
#include "upb/port_def.inc"

@ -28,14 +28,18 @@
#ifndef UPB_MESSAGE_VALUE_H_
#define UPB_MESSAGE_VALUE_H_
#include "google/protobuf/descriptor.upb.h"
#include "upb/msg.h"
#include "upb/string_view.h"
#include "upb/upb.h"
// Must be last.
#include "upb/port_def.inc"
#ifdef __cplusplus
extern "C" {
#endif
// Definitions commn to both upb_Array and upb_Map.
// Definitions common to both upb_Array and upb_Map.
typedef union {
bool bool_val;
@ -45,16 +49,16 @@ typedef union {
int64_t int64_val;
uint32_t uint32_val;
uint64_t uint64_val;
const upb_Array* array_val;
const upb_Map* map_val;
const upb_Message* msg_val;
const upb_Array* array_val;
upb_StringView str_val;
} upb_MessageValue;
typedef union {
upb_Array* array;
upb_Map* map;
upb_Message* msg;
upb_Array* array;
} upb_MutableMessageValue;
#ifdef __cplusplus

@ -27,6 +27,8 @@
#include "upb/mini_table_accessors.h"
#include "upb/decode.h"
#include "upb/encode.h"
#include "upb/mini_table.h"
#include "upb/msg_internal.h"

@ -36,11 +36,10 @@
#ifndef UPB_MSG_H_
#define UPB_MSG_H_
#include <stddef.h>
#include "upb/arena.h"
// TODO(b/232091617): Remove this and fix everything that breaks as a result.
#include "upb/extension_registry.h"
#include "upb/upb.h"
// Must be last.
#include "upb/port_def.inc"
#ifdef __cplusplus
extern "C" {
@ -50,7 +49,6 @@ typedef void upb_Message;
/* For users these are opaque. They can be obtained from
* upb_MessageDef_MiniTable() but users cannot access any of the members. */
struct upb_MiniTable;
typedef struct upb_MiniTable upb_MiniTable;
/* Adds unknown data (serialized protobuf data) to the given message. The data
@ -64,6 +62,8 @@ const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len);
/* Returns the number of extensions present in this message. */
size_t upb_Message_ExtensionCount(const upb_Message* msg);
#include "upb/port_undef.inc"
#ifdef __cplusplus
} /* extern "C" */
#endif

@ -410,12 +410,12 @@ UPB_INLINE bool _upb_has_submsg_nohasbit(const upb_Message* msg, size_t ofs) {
/** upb_Array *****************************************************************/
/* Our internal representation for repeated fields. */
typedef struct {
struct upb_Array {
uintptr_t data; /* Tagged ptr: low 3 bits of ptr are lg2(elem size). */
size_t size; /* The number of elements in the array. */
size_t capacity; /* Allocated storage. Measured in elements. */
uint64_t junk;
} upb_Array;
};
UPB_INLINE const void* _upb_array_constptr(const upb_Array* arr) {
UPB_ASSERT((arr->data & 7) <= 4);
@ -567,14 +567,14 @@ UPB_INLINE bool _upb_Array_Append_accessor(void* msg, size_t ofs,
/* Right now we use strmaps for everything. We'll likely want to use
* integer-specific maps for integer-keyed maps.*/
typedef struct {
struct upb_Map {
/* Size of key and val, based on the map type. Strings are represented as '0'
* because they must be handled specially. */
char key_size;
char val_size;
upb_strtable table;
} upb_Map;
};
/* Map entries aren't actually stored, they are only used during parsing. For
* parsing, it helps a lot if all map entry messages have the same layout.

@ -51,6 +51,11 @@
extern "C" {
#endif
// These types appear in circular references so we need to forward-declare them.
// There is no obviously good place for this so let's just put it here.
typedef struct upb_Array upb_Array;
typedef struct upb_Map upb_Map;
/* Constants ******************************************************************/
/* A list of types as they are encoded on-the-wire. */

Loading…
Cancel
Save