The change is no-op for Bazel < 8, it always falls back to native providers.
When we cherry-pick --incompatible_autoload_externally to older Bazels, ProtoInfo
can be replaced with Starlark implementation, providing that users set the flag so that there is no second implementation exposed from Bazel.
PiperOrigin-RevId: 674561141
This enables enforcement of lifetime specifications on individual enum values for features. It will allow us to add new values to existing features, as well as deprecate/and remove existing values. By default, each value will be scoped to the lifetime spec of its corresponding feature field. However, individual lifetime boundaries can be overridden at the value-level for finer grained control.
In the near-term, this will allow us to deprecate/remove required field presence, and add a stricter utf8 validation feature.
PiperOrigin-RevId: 672710484
This simplifies upb by removing differences between google3 and OSS.
This also points upb at the protobuf license, instead of keeping a separate copy around for upb.
PiperOrigin-RevId: 669447145
instantiate objects if permitted by the compiler.
We can use memset for zero initialized objects, and memcpy for ones cloned from
the prototype.
This permits creating objects from the parser without calling virtual
functions.
For the cases where the efficient implementation can't be used, we generate a
"placement new" style function to offload the memory allocation out of the code
generation. This reduces code bloat even when we can't use the more efficient
implementation.
Migrate many callers of `New` and similar to the new functionality. In
particular, the parsing paths will use this.
Finally, make `New` non-virtual now that `MessageLite` can handle it directly.
It reduces binary size.
PiperOrigin-RevId: 668077355
We can use memset for zero initialized objects, and memcpy for ones cloned from the prototype.
This permits creating objects from the parser without calling virtual functions.
For the cases where the efficient implementation can't be used, we generate a "placement new" style function to offload the memory allocation out of the code generation. This reduces code bloat even when we can't use the more efficient implementation.
Migrate many callers of `New` and similar to the new functionality. In particular, the parsing paths will use this.
Finally, make `New` non-virtual now that `MessageLite` can handle it directly. It reduces binary size.
PiperOrigin-RevId: 665411723
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