SIGN IN SIGN UP

Protocol Buffers - Google's data interchange format

0 0 35 C++

Enhance ParseInfoTree to provide location of names and values.

This change adds `GetFieldLocation` method
`ParseInfoTree` to allow users to retrieve the location of field names and
field values separately from the location of the entire field label-value pair.

The parser has been updated to record these locations during text proto parsing.
This includes support for singular fields, repeated fields (including short
format), message fields, maps, and Any expansion.

Deprecated existing `GetLocation` and `GetLocationRange` methods as the new method is a superset of the existing methods. Once internal users migrated to use the new method, the legacy methods will be marked for deletion.

In `text_format_unittest.cc`
- Refactored location expectation helpers into a single `ExpectAllLocations` method that takes a struct with designated initializers for better readability and to ensure all locations are checked together.
- Updated all `ParseInfoTree` related tests to use the new `ExpectAllLocations` helper and verify name, value, and overall span locations using dot-notation for struct initialization.

PiperOrigin-RevId: 893893007
M
Mikita Belahlazau committed
1cb4fdb8eaaa60917cdbd23cf6f38fc5f1307054
Parent: 1e6186a
Committed by Copybara-Service <copybara-worker@google.com> on 4/3/2026, 5:42:09 AM