This represents the future direction of protobuf, replacing proto2/proto3 syntax with editions. These will enable more incremental evolution of protobuf APIs through features, which are individual behaviors (such as whether field presence is explicit or implicit). For more details see https://protobuf.dev/editions/overview/.
This PR contains a working implementation of editions for the protoc frontend and C++ code generation, along with various infrastructure improvements to support it. It gives early access for anyone who wants to a preview of editions, but has no effect on proto2/proto3 syntax. It is flag-guarded behind the `--experimental_editions` flag, and is an experimental feature with no guarantees.
PiperOrigin-RevId: 544805690
It's not clear what happens if both C++17/C++20 and C++14 are specified, so it's possible this was effectively disabling those tests.
PiperOrigin-RevId: 544763031
This handles conversion from descriptors to MessageInfo in a single generic codepath that handles the following differences across syntaxes:
- Enum closedness (proto2)
- Explicit (proto2) vs implicit (proto3) presence
- Required field initialization (proto2)
- UTF8 (proto2/3 specific options)
This also fixes proto3 non-optional messages to encode hasbit, which was updated in cl/542744002
PiperOrigin-RevId: 544358617
We were always emitting Optional<T> for accessors, when they should've been behind `_opt`.
We've refactored our previous accessor into `getter` and `getter_opt`. We'll only emit `getter_opt` when we're dealing with optional fields.
PiperOrigin-RevId: 544087591
Needed to lowercase fieldnames and add underscores when they use protected cpp names. Ended up using `cpp::FieldName` from the cpp impl to get this for free.
Also added escaping to Rust accessors, so that protected keywords will compile.
PiperOrigin-RevId: 543995050
This fix works in Bazel 5 and 6, but the original `import pddm` only works in Bazel 5. This is preventing our upgrade to Bazel 6 that will reduce our mac flakes in CI.
PiperOrigin-RevId: 543565397
This class enables storing all such default objects in the same default zero buffer.
The motivation for this is usage in split repeated fields.
PiperOrigin-RevId: 543465667
Popcount instructions are widely available on most architectures. Conditioning
the codepath on __POPCNT__ limits the optimization to x86.
PiperOrigin-RevId: 543454555
- Add an empty() accessor to WeakRepeatedPtrField.
- Don't assume ShouldSplit is false for repeated fields.
- For repeated field tracker generated code, call field internal accessors instead of accessing fields by name.
PiperOrigin-RevId: 542936038
The motivation is that in the case of split repeated fields, we end up calling Arena::CreateMessage<RepeatedPtrFieldBase>, and RepeatedPtrFieldBase has a protected destructor.
PiperOrigin-RevId: 542905924
This handles the following proto2/3 differences in single parseMessage codepath that works for proto2, proto3, and editions
- Groups (proto2)
- Open (proto3) vs closed (proto2) enums, incl closed enums in unknown fields
- Extensions (proto2)
- No presence (proto3)
PiperOrigin-RevId: 542872685