| 732 | } |
| 733 | |
| 734 | void EmitFunctionList( |
| 735 | YAML::Emitter& out, absl::string_view key, |
| 736 | const absl::flat_hash_set<std::pair<std::string, std::string>>& functions) { |
| 737 | if (functions.empty()) { |
| 738 | return; |
| 739 | } |
| 740 | |
| 741 | // Build a map from function name to a vector of overload ids. |
| 742 | // Using std::map ensures function names are sorted. |
| 743 | std::map<std::string, std::vector<std::string>> function_overloads; |
| 744 | for (const auto& pair : functions) { |
| 745 | function_overloads[pair.first].push_back(pair.second); |
| 746 | } |
| 747 | |
| 748 | out << YAML::Key << std::string(key) << YAML::Value << YAML::BeginSeq; |
| 749 | for (auto const& [name, overloads] : function_overloads) { |
| 750 | out << YAML::BeginMap; |
| 751 | out << YAML::Key << "name"; |
| 752 | out << YAML::Value << YAML::DoubleQuoted << name; |
| 753 | |
| 754 | // If the only overload is the empty string, it signifies that all overloads |
| 755 | // of the function are included/excluded. In this case, we don't emit the |
| 756 | // "overloads" key. Otherwise, emit the specific overloads. |
| 757 | if (!(overloads.size() == 1 && overloads[0].empty())) { |
| 758 | // Sort overloads for deterministic output. |
| 759 | std::vector<std::string> sorted_overloads = overloads; |
| 760 | absl::c_sort(sorted_overloads); |
| 761 | |
| 762 | out << YAML::Key << "overloads" << YAML::Value << YAML::BeginSeq; |
| 763 | for (const std::string& overload : sorted_overloads) { |
| 764 | out << YAML::BeginMap; |
| 765 | out << YAML::Key << "id"; |
| 766 | out << YAML::Value << YAML::DoubleQuoted << overload; |
| 767 | out << YAML::EndMap; |
| 768 | } |
| 769 | out << YAML::EndSeq; |
| 770 | } |
| 771 | out << YAML::EndMap; |
| 772 | } |
| 773 | out << YAML::EndSeq; |
| 774 | } |
| 775 | |
| 776 | void EmitStandardLibraryConfig(const Config& env_config, YAML::Emitter& out) { |
| 777 | const Config::StandardLibraryConfig& standard_library_config = |
no test coverage detected