`GPBTextFormatForMessage()` will contain any information for unknown fields.
And it clears the way for `GPBUnknownFieldSet` to eventually be deprecated
also.
PiperOrigin-RevId: 655184316
GenerateByteSize itself remains deeply nested, but by factoring out one part of
the loop, at least we make the part that generates UpdateByteSize a bit more
readable.
Making the callsite of MayEmitIfNonDefaultCheck less nested actually resulted
in slight readability improvements also in the generated code, namely of the
form:
@@ -10563,8 +10559,7 @@ PROTOBUF_NOINLINE void OneStringEdition:
{
// string data = 1;
- cached_has_bits =
- this_._impl_._has_bits_[0];
+ cached_has_bits = this_._impl_._has_bits_[0];
if (cached_has_bits & 0x00000001u) {
total_size += 1 + ::proto2::internal::WireFormatLite::StringSize(
this_._internal_data());
These readability improvements should be kept IMO -- they make the generated
protobuf C++ code slightly easier to read.
PiperOrigin-RevId: 655180880
The toolchain type is consumed by proto_library and produced by proto_toolchain rule. As such it's a private dependency, because both rules are now part of protobuf repo.
There are some early adopters of --incompatible_enable_proto_toolchain_resolution that might be broken from this: grpc, rules_go, rules_ts, rules_rust, rules_lint, because they have implementation that is not using proto_common. Those repositories need to define their own proto_lang_toolchain and consume it with proto_common.compile.
PiperOrigin-RevId: 654897871
Make a new internal api for collecting up the unknown group fields
that will be used in a future change.
Add testing for the new api and for unknown field parsing of groups in
general.
PiperOrigin-RevId: 654875605
When you have a `T: SomeTrait + ?Sized` and `trait SomeTrait:Sized`, the ?Sized has no effect (its not able to "remove" the requirement).
PiperOrigin-RevId: 654836513
Something has changed between Xcode and xcpretty such that
we don't get full logs when something fails to know what
file/line is actually failing; so stop using it.
PiperOrigin-RevId: 654830446
Also mark the helper as not inline able to avoid the code being over duplicated
within the file with some compiler optimizations turned on.
PiperOrigin-RevId: 654826102
ShouldEmitIfNonDefaultCheck is mostly called in MayEmitIfNonDefaultCheck,
except in one location in GenerateByteSize.
Making MayEmitIfNonDefaultCheck the only caller of ShouldEmitIfNonDefaultCheck
seems like a good application of DRY and reduces the possibility of unintended
divergence in the future. It also makes future changes to serialization logic
easier.
There should be no changes to the resulting generated code.
PiperOrigin-RevId: 654789393
This also changes MessageView and MessageMut to be subtraits of the ViewProxy and MutProxy (which also requires them to have lifetimes now, and a weird extra bounds on ViewProxy)
PiperOrigin-RevId: 654788207
- Now it is arena constructible. Allocates the array, strings, and inner sets in the arena.
- Now it is arena destructible. Will skip destructors when in an arena.
Also, optimize `default_instance()` now that we can provide a `constinit` version of it.
PiperOrigin-RevId: 654743861
Not always emitting the opening brace in this function call can give the caller
a bit more flexibility: for example, it allows for easier use of formatted
string substitutions when both the opening and the closing brace can be
accounted for by the same caller.
PiperOrigin-RevId: 654113509
That way we avoid the extra function call and they behave more like normal
virtual functions.
Has no effect in normal mode.
PiperOrigin-RevId: 654039245
We can't directly use std::atomic because Extension needs to be trivially copyable.
Also move the Extension member functions before the data members to comply with Google C++ style guide.
PiperOrigin-RevId: 653701040
This should provide the roughly same result as ctype, except that it reflects actual behavior rather than the specification in the proto file. VIEW will now be visible, and some subtleties around CORD and PIECE will change.
PiperOrigin-RevId: 653677655
Motivation: these accessors (e.g. size(), Capacity()) will have branches on `is_soo()` so it's best to avoid calling them repeatedly if we can instead save the result in a local variable.
Also update some comments to avoid referring to the names of data members that will no longer exist with SOO.
PiperOrigin-RevId: 653672810
Rather than two traits (MutProxy subtrait of ViewProxy), instead have three traits (MutProxy subtrait of Proxy, and ViewProxy subtrait of Proxy).
This makes things more consistent, including that (MutProxied subtraits Proxied) is now more parallel to (MutProxy subtraits Proxy).
ViewProxy is largely a marker trait here but leaves a spot for methods that should be on ViewProxies but not MutProxies if those do show up later.
PiperOrigin-RevId: 653661953