Only emit has_field() if the field support presence. Only emit field_opt() getter if the field is both optional and supports presence.
PiperOrigin-RevId: 555133374
This CL adds function bodies for: {as_view, into_view, as_mut, into_mut, set_on} [1].
Our prior cl/552609955 didn't have `RawMessage` inside $Msg$Mut, so that's also been rectified in this CL.
[1] Everything in this set is a part of the Proxied trait, except set_on, which belongs to the SettableValue trait.
PiperOrigin-RevId: 553935803
do them only once at the beginning instead of for each element.
In the past we hoisted the `rep` checks. This change continues that pattern.
PiperOrigin-RevId: 553901961
These are more type safe, and more clearly distinguish between a
raw message and serialized data.
This also defines a macro to create new opaque pointer types, and
switches `RawArena` to using it.
PiperOrigin-RevId: 552957136
This CL sets up the basic plumbing end-to-end for singular message fields.
We add skeletonized support for `Proxied` messages. This is done
by creating structs for $Msg$View and $Msg$Mut, and providing
stubbed impls.
PiperOrigin-RevId: 552609955
- Separate per message options out of PerFieldOptions. We don't need to query
these once per field, and they might be useful even when no fields exist.
- Move FastEv check for !uses_codegen into generated_message_tctable_gen.cc
instead of checking for function names. It is more robust this way.
- Use a variant in FastFieldInfo to make it clear which fields belong to each alternative, and add accessors to easily check for the alternatives.
PiperOrigin-RevId: 551234589
Asan is designed with assumption that by default, stack is unpoisoned.
What ever is poisoned by instrumentation in the stack frame, will be unpoisoned on return.
This assumption applies to user poisoned regions. If it left unpoisoned
it may cause false reports in unrelated stack frames.
PiperOrigin-RevId: 550916830
This is a cleanup that is intended to reduce the noise in current and planned protocol compiler code, and improve readability of the code.
PiperOrigin-RevId: 550631662
When `DescriptorBuilder::BuildFileImpl` is called, `alloc.AllocateArray` appears to be allocating an uninitialized object. This means every field inside FileDescriptor should be initialized, and edition_ may be ignored if not present. This can then lead to a SEGFAULT later in `FileDescriptor::edition()`, with a check of `edition_ == nullptr ? anti_hyrum_string : *edition_;` potentially dereferencing `edition_` when it's uninitialized.
PiperOrigin-RevId: 549712519
Design details:
- We store the split repeated fields inline in the Split struct by pointer. We use pointers so that we can save memory when the fields are absent and so that the split struct will still be trivially copyable.
- If we had instead stored the repeated fields by value, then we would need to add virtual functions to each Message that would call the constructors of the repeated fields which we would call during parsing after allocating non-default split structs.
PiperOrigin-RevId: 549673919
If a proto_library has more than one srcs, we designate the first one as the primary (that file will be passed to rustc as the crate root). All other files will represent (internal) submodules of the crate.
In general, Rust users won't see which .proto file a message came from, they will only see a crate corresponding to the entire proto_library, and in it public submodules for all `package` statements in all .proto files in the proto_library sources. Therefore in this CL we reexport all messages from non primary sources into their corresponding public modules (= packages declared in their owning .proto files).
Besides the common case this CL also handles .proto files without package statement, and a subset of behaviors needed for public import functionality.
PiperOrigin-RevId: 549543321
This optimizes non const and copy initialization of arena string values. String hardening is automatically performed on as needed by the ArenaStringPtr class, removing the need for extra clutter or set operations added by the protocol compiler in generated code.
PiperOrigin-RevId: 549480061