1. getter function to access the upb_Map corresponding to a map proto field
2. conversion function to get a Go map from a upb_Map. The conversion function uses generics, so it must be a standalone function independent of `MessageAccessor`.
Accessing map fields is not as efficient as accessing other proto field types, because of two reasons:
- we need to make a copy of map values in Go, since the memory representations are different in UPB C
- we need to call C functions from Go, because the upb_Map struct fields are not exported and we can't access the bits directly, causing performance overhead
Luckily the map fields can be quite rare, so the performance overhead should not be too significant overall.
PiperOrigin-RevId: 559191359
Remove message/message.h as a hdr from :message_internal
Lock down the visibility of :message_types to upb-only
message/types.h is not an internal header because the definitions there are part of the public surface. But the fact that it needs to exist is an implementation detail that should remain opaque, so make it a private dep.
PiperOrigin-RevId: 558960776
Remove array.h and map.h as hdrs from :collections_internal
Remove alloc.h and arena.h as hdrs from :mem_internal (and add them to :mem)
Remove common.h and decode.h and encode.h as hdrs from :wire_internal
Lock down the visibility of :wire_internal to upb-only
Merge :mini_descriptor_encode_internal into :mini_descriptor_internal
PiperOrigin-RevId: 558235138
When build a FileDescriptorProto into pool, FieldDescriptorProto.type may not set if type_name is set. Runtime Change. To make copybara happy, tests will be added in a separate change
PiperOrigin-RevId: 553881407
Clang and GCC differ on how they detect Address Sanitizer. Support both.
Closes#1424
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/upb/pull/1424 from protocolbuffers:asan-clang 491a5ee4cfd24c8eb281f894de0cf4384525c46a
PiperOrigin-RevId: 553805994
When build a FileDescriptorProto into pool, FieldDescriptorProto.type may not set if type_name is set. Runtime Change. To make copybara happy, tests will be added in a separate change
PiperOrigin-RevId: 553598520
The next in a series of CLs to split upb/BUILD into subdirs.
Create mem/internal/
Delete the deprecated upb/arena.h and upb/alloc.h stub headers
PiperOrigin-RevId: 552864952
When build a FileDescriptorProto into pool, FieldDescriptorProto.type may not set if type_name is set. Runtime Change. To make copybara happy, tests will be added in a separate change
PiperOrigin-RevId: 552521056
On 32-bit targets (including WASM), the base message pointer was aligned to 4 instead of 8, causing reads to 8-byte fields to fail, since TypedArray does not support unaligned reads.
The pointer was 4-byte aligned because upb adds the size of its "internal" pointer before returning the `upb_Message*`. We should probably stop doing this, and instead have the MiniTable offsets reflect their full and true offset from the pointer returned by `malloc()`.
PiperOrigin-RevId: 552486609
At some point, the typedef for upb_MiniTable, upb_MiniTableEnum and upb_MiniTableExtension were moved out of the internal headers and into the public ones, which requires usages of internal/file.h to import / resolve those public headers before it.
PiperOrigin-RevId: 548836379
pkg_files() has some odd quirks, like breaking if a filename exists in multiple directories. filegroup() does everything we need, without these quirks.
PiperOrigin-RevId: 547523447
This will move us towards keeping all these encapsulation breaks in a common place.
This also removes the IFTTT blocks. Keeping IFTTT blocks for each language would become unmanageable, but going forward we will know to look in `//third_party/upb/bits` whenever the internal data structures in upb change.
PiperOrigin-RevId: 547494495
upb has an implementation-specific maximum of 63 required fields per message. We need to verify this limit when building a MiniTable.
PiperOrigin-RevId: 546929196
This special `proto_library` behavior is known as an *alias library*:
https://bazel.build/reference/be/protocol-buffer#proto_library_args
Without this CL, the compilation of the added test fails with:
```
test_import_empty_srcs.upb.c:12:10: error:
module :test_import_empty_srcs_proto.upb does not depend on a
module exporting 'test.upb.h'
```
PiperOrigin-RevId: 545153380
After this change, `mini_table` only has MiniTable definitions themselves. Everything having to do with the MiniDescriptor wire format is in `mini_descriptor`.
Also rearranged some of the files in mini_table to have better structure for `internal/`.
This CL contains no functional change.
PiperOrigin-RevId: 543529112
Move to a friend nonmember functions taking both arguments by reference-to-const.
Closes#1199
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/upb/pull/1199 from phallot:fix/ambiguous-reversed-operator 4ef9f65e7539df330943a55e257b5f8a87a208ca
PiperOrigin-RevId: 542572888
- Match build target names to their corresponding file names (remove stuttering)
- Replace a dep on (deprecated) :upb with a dep on :wire
- Mark :struct_upb_proto as testonly
- Group the cc_test targets together
PiperOrigin-RevId: 541408625