Also, add reference overloads of DynamicCastToGenerated which terminate on failure like dynamic_cast would do on an environment without exceptions.
PiperOrigin-RevId: 571241355
This removes a large chunk of the reflection we need to do during descriptor builds, and will make it possible to migrate descriptor.proto to editions. It also removes some special treatment of the C++ runtime, which happens to have easy access to protoc internals today.
PiperOrigin-RevId: 571177924
This is meant to optimize our editions handling before rolling it out more widely to proto2 and proto3 under the hood. As it's implemented today, every file descriptor would need to allocate its own duplicate FeatureSet for either proto2 or proto3 (plus additional ones per proto2 group).
PiperOrigin-RevId: 571166907
This hooks up legacy proto2/proto3 editions, but prohibits them from being used in proto files. These will be hooked up directly to `syntax` declarations in a later change.
PiperOrigin-RevId: 570746314
These exist so that new features can specify their proto2/proto3 defaults. This will allow for easier migration to editions, and also allow us to migrate more proto2/proto3 code paths to common editions code. The latter will provide give us early coverage over a lot more of editions.
PiperOrigin-RevId: 570576252
This is preparation work to merge the vtable with the `ReflectionPayload`
object to reduce the size of MapField by 8 bytes.
PiperOrigin-RevId: 570387900
This makes the file layout a bit more consistent with the `protos ->
protos_generator` pattern. I also replaced the `upbc` namespace with
`upb::generator`.
PiperOrigin-RevId: 569264372
It was swapping the arena pointers too when they differed. In that case a full
copy must be made instead. The instances can't change arenas.
PiperOrigin-RevId: 569166797
This will reduce the number of times our test protos are built, and may fix the flakes we're seeing in aarch64. At the very least, it should reduce them by a factor of 3 and marginally speed up our builds.
PiperOrigin-RevId: 568963559
This change moves almost everything in the `upb/` directory up one level, so
that for example `upb/upb/generated_code_support.h` becomes just
`upb/generated_code_support.h`. The only exceptions I made to this were that I
left `upb/cmake` and `upb/BUILD` where they are, mostly because that avoids
conflict with other files and the current locations seem reasonable for now.
The `python/` directory is a little bit of a challenge because we had to merge
the existing directory there with `upb/python/`. I made `upb/python/BUILD` into
the BUILD file for the merged directory, and it effectively loads the contents
of the other BUILD file via `python/build_targets.bzl`, but I plan to clean
this up soon.
PiperOrigin-RevId: 568651768
<iostream> embeds a global constructor (to initialize std::cout and such), typically `static ios_base::Init __ioinit;` in libstdc++).
This header is not directly necessary in the common header and has a small impact on every compilation unit that includes it.
As an example, removing that header dependency in turns suppresses 33 global constructors from the firefox core library libxul.
Closes#14174
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/14174 from serge-sans-paille:feature/remove-iostream-from-common d3a6be6ee4
PiperOrigin-RevId: 568626744
This allows the compiler to statically detect use-after-free bugs.
This change touches a subset of field types. More changes to follow.
PiperOrigin-RevId: 568586855
The most common MergeFrom() scenario is that items are newly appended to an existing repeated field that has never been shrunk. For these cases copy constructing new entries is the cheapest option. This change overloads MergeFrom<> for `std::string`, `StringPiece`, `Message` and `MessageLite`, leaving the remaining templated implementation for all concrete message types supporting arena enabled copy construction, which is implemented as an out of line factory functor implementation.
Going forward we should change `Arena::CreateMaybeMessage()` to return MessageLite* and accept const MessageLite& for copy construction. This will allow us to directly pass Arena::CreateMaybeMessage<T>() into these out of line functions.
PiperOrigin-RevId: 568220325
If using minimal imports, a non direct import might be needed because
it is a public import of an other wise not required header; ensure
the import makes it into the generated code to type definitions can
be found.
PiperOrigin-RevId: 567672195