General test for it is done in Rust, and then extensions are tested in UPB as they're not currently supported in Rust-upb.
PiperOrigin-RevId: 651113583
Calling into_proxied() already does a copy and before this change we were doing a second one.
I am not using set_allocated_<field(std::string* s) because the method is not generated when [features.(pb.cpp).string_type = VIEW] is specified.
PiperOrigin-RevId: 650612909
* The public Repeated::{push, set} and Map::insert methods now accept any value that implements IntoProxied<T>, allowing us to move owned values instead of copying them.
* This change also updates the FFI layer for strings/bytes in the repeated and maps thunks to accept a std::string* that can be moved rather than a PtrAndLen type that needs to be copied.
* Tests are updated to no longer .as_view() when setting a message / string on a repeated / map field. The IntoProxied trait makes calling .as_view() obsolete.
PiperOrigin-RevId: 650580788
In that mode we might not be able to make a `constexpr` pointer to the default
instance. Omitting the declaration will only turn off an optimization, but the
code will still be correct.
Fixes https://github.com/protocolbuffers/protobuf/issues/17303
PiperOrigin-RevId: 649160060
This will mean that calling DebugString on a MessageLite* which is actually a full Message will get the debug info instead of the minimal output.
PiperOrigin-RevId: 649103508
Besides unnecessary inconsistency on our C symbols, double underscores anywhere in the name are reserved for stdlib use. In practice its unlikely these symbols would ever hit a collision problem (maybe the prior name 'utf8_debug_string' with no prefix as having some risk), but safer to just standardize on this and have no concerns going forward.
PiperOrigin-RevId: 648709299
runtime that does not change observable behavior of the APIs. For example, fast-vs-slow path decisions.
Has to be turned on at compile time, and otherwise it is a noop.
PiperOrigin-RevId: 648412330
make the TcParseTable point to the ClassData.
This will allow the parser to use more information from the class in the
future.
PiperOrigin-RevId: 648377537
- In most cases, migrate to `absl::string_view`.
- When capturing a temporary string in a variable, use `const std::string` without the ref.
We avoid changing virtual function parameters in this CL, since that is a breaking change.
PiperOrigin-RevId: 647686085
error message from Dynamic/DownCastMessage when trying to downcast a
DynamicMessage to a generated type.
Previously the error message would say "can't down cast Foo to Foo", which is
confusing.
PiperOrigin-RevId: 647363909
**Description**
Added a cmake option to enable Unity builds for libprotobuf-lite.
Added missing symmetric include for port_def.inc
Added preproc guards for PROTOBUF_PRAGMA_INIT_SEG so it does not get included multiple times in unity build.
**Motivation and Context**
For large code base, especially in the game dev industry, Unity builds (https://en.wikipedia.org/wiki/Unity_build) are used to speed up the compilations.
Special care must be taken to enable Unity builds for a project, since many translation units will be merged togheter.
Closes#16454
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/16454 from jslap-ubi:enable-unity-build a387ffd862
PiperOrigin-RevId: 646581094
We change InferLegacyProtoFeatures to set ctype based on string_type when string_type is set. We need to update CppGenerator::ValidateFeatures to allow both ctype and string_type to be set because it runs after InferLegacyProtoFeatures.
PiperOrigin-RevId: 645480157
This class is preferred over using `typeid` for a few reasons:
- It works with RTTI disabled.
- It works for `DynamicMessage` types.
- It works in custom vtable mode.
PiperOrigin-RevId: 645145751