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
This is a performance optimisation that avoids us going through from
AbstractList.add(E) to LazyStringArrayList.add(int index, String) and then
having to call the index-based add in ArrayList, which has more bookkeeping
around moving elements across if necessary.
We can avoid that bookkeeping by adding this overload.
Also, group together overloads to squash a style warning.
PiperOrigin-RevId: 650089286
This should slightly speed things up.
Should be safe: these operations don't change the number of entries inside the loop.
PiperOrigin-RevId: 650087172
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
`GPBUnknownFields` additions:
- Provide `Optional` based apis for the `getFirst*` apis.
- Map the `NSFastEnumeration` over as a `Sequence` to support looping over the fields.
`GPBUnknownField` addition:
- Add an `enum` with associated values to provide a more type-safe way for inspection.
PiperOrigin-RevId: 649090744
This is currently true and required by the IntoProxied trait. In Rust all type parameters are explicitly marked `Sized`, except for `Self` [1]. By marking `Proxied` as `Sized` we can write `IntoProxied<Self>` in generic code without having to add 'where Self: Sized` clauses.
An implication of this change is that Proxied can no longer be used from a trait object i.e. `let x: dyn &Proxied = &foo` will not compile. We are not anticipating such use cases at this point.
[1] https://doc.rust-lang.org/std/marker/trait.Sized.html
PiperOrigin-RevId: 649010900
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
`GPBUnknownFields` will be the eventually replacement for `GPBUnknownFieldSet`. This
introduces the type and the changes to `GPBUnknownField`.
The new api will preserve the wire ordering of unknown fields. This is now checked
in conformance tests.
While this adds the type changes and tests them, it does not yet wire the changes
in to the rest of the Runtime, so the conformance tests still done pass.
`GPBUnknownFieldSet` also hasn't been deprecated yet, that will come in later with
the wiring in to the runtime.
PiperOrigin-RevId: 648361455
This should significantly reduce the size of large arenas. Previously, a large arena would nearly double in size if the most recent block filled up. This could end up wasting large amounts of memory. After this CL, we will waste at most the max block size, which defaults to 32k.
This more or less matches the behavior of the C++ arena.
PiperOrigin-RevId: 647802280
Export `PrivacyInfo.xcprivacy` file to allow users of protobuf to access the file from Bazel, e.g. to bundle it with an iOS application.
Closes#17054
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/17054 from mjburghard:export-privacy-manifest 4869cabc3d
PiperOrigin-RevId: 647791805