Skip to content

Commit 0aa5c08

Browse files
committed
Use unordered_set
1 parent 099c97b commit 0aa5c08

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎cpp2rust/converter/rules/registry.cpp‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <cstdlib>
1616
#include <filesystem>
1717
#include <format>
18-
#include <set>
1918
#include <string>
2019
#include <unordered_map>
2120
#include <unordered_set>
@@ -86,7 +85,7 @@ clang::QualType getInitPattern(const clang::FunctionDecl *rule) {
8685
}
8786

8887
void collectGenerics(const std::vector<TranslationRule::BodyFragment> &body,
89-
std::set<unsigned> &used) {
88+
std::unordered_set<unsigned> &used) {
9089
for (const auto &fragment : body) {
9190
if (auto generic =
9291
std::get_if<TranslationRule::GenericFragment>(&fragment)) {
@@ -100,7 +99,7 @@ void collectGenerics(const std::vector<TranslationRule::BodyFragment> &body,
10099
}
101100
}
102101

103-
void collectGenerics(llvm::StringRef type, std::set<unsigned> &used) {
102+
void collectGenerics(llvm::StringRef type, std::unordered_set<unsigned> &used) {
104103
auto is_ident = [](char c) { return llvm::isAlnum(c) || c == '_'; };
105104
for (size_t i = 0; i < type.size(); ++i) {
106105
if (type[i] != 'T' || (i > 0 && is_ident(type[i - 1]))) {
@@ -128,7 +127,7 @@ void checkGenerics(const std::string &dir, const std::string &name,
128127
declared.insert(param->getName().str());
129128
}
130129
}
131-
std::set<unsigned> used;
130+
std::unordered_set<unsigned> used;
132131
collectGenerics(rule.body, used);
133132
collectGenerics(rule.return_type.type, used);
134133
for (const auto &param : rule.params) {

0 commit comments

Comments
 (0)