Skip to content

Commit

Permalink
Prepare code for breaking change in Protobuf C++ API.
Browse files Browse the repository at this point in the history
Protobuf 6.30.0 will change the return types of `Descriptor::name()` and other methods to `absl::string_view`. This makes the code work both before and after such a change.

PiperOrigin-RevId: 674077205
  • Loading branch information
evalon32 authored and Google-ML-Automation committed Sep 13, 2024
1 parent c5346ef commit 7e47cbb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion xla/service/hlo_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5231,7 +5231,7 @@ bool HloParserImpl::ParseAttributesAsProtoMessage(
// Populate the storage of expected attributes from the protobuf description.
for (int field_idx = 0; field_idx < descriptor->field_count(); field_idx++) {
const tsl::protobuf::FieldDescriptor* fd = descriptor->field(field_idx);
const std::string& field_name = fd->name();
absl::string_view field_name = fd->name();
switch (fd->type()) {
case tsl::protobuf::FieldDescriptor::TYPE_BOOL: {
bool_params.emplace_back(std::nullopt);
Expand Down

0 comments on commit 7e47cbb

Please sign in to comment.