Fixed non-determinism in the upb compiler.

PiperOrigin-RevId: 503574792
pull/13171/head
Joshua Haberman 2 years ago committed by Copybara-Service
parent ac471fe675
commit a780ffae65
  1. 4
      upbc/file_layout.cc

@ -56,6 +56,10 @@ std::vector<upb::EnumDefPtr> SortedEnums(upb::FileDefPtr file) {
for (int i = 0; i < file.toplevel_message_count(); i++) {
AddEnums(file.toplevel_message(i), &enums);
}
std::sort(enums.begin(), enums.end(),
[](upb::EnumDefPtr a, upb::EnumDefPtr b) {
return strcmp(a.full_name(), b.full_name()) < 0;
});
return enums;
}

Loading…
Cancel
Save