Skip to content

Commit

Permalink
Fix case of locality optimizer being wrong for split repeated fields …
Browse files Browse the repository at this point in the history
…and add a check that the optimized order has the same size as the unoptimized order.

PiperOrigin-RevId: 543779555
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Jun 27, 2023
1 parent ee5cf35 commit 76a327e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/google/protobuf/compiler/cpp/message.cc
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,10 @@ MessageGenerator::MessageGenerator(
}
}

const size_t initial_size = optimized_order_.size();
message_layout_helper_->OptimizeLayout(&optimized_order_, options_,
scc_analyzer_);
ABSL_CHECK_EQ(initial_size, optimized_order_.size());

// This message has hasbits iff one or more fields need one.
for (auto field : optimized_order_) {
Expand Down

0 comments on commit 76a327e

Please sign in to comment.