diff --git a/cpp2rust/converter/converter.cpp b/cpp2rust/converter/converter.cpp index 1318c6f1..39696202 100644 --- a/cpp2rust/converter/converter.cpp +++ b/cpp2rust/converter/converter.cpp @@ -3558,7 +3558,7 @@ std::string Converter::ConvertMappedMethodCall( std::string Converter::GetMappedAsString(clang::Expr *expr, clang::Expr **args, unsigned num_args, TempMaterializationCtx *ctx) { - auto *tgt_ir = Mapper::GetExprTgt(GetCalleeOrExpr(expr)); + auto *tgt_ir = Mapper::GetExprRule(GetCalleeOrExpr(expr)); if (!tgt_ir) return {}; @@ -3582,10 +3582,10 @@ std::string Converter::ConvertIRFragment( if (auto *t = std::get_if(&frag)) { result += t->text; } else if (auto *g = std::get_if(&frag)) { - result += Mapper::InstantiateTemplate(GetCalleeOrExpr(expr), g->name); + result += Mapper::InstantiateTemplate(GetCalleeOrExpr(expr), g->n); } else if (auto *ph = std::get_if(&frag)) { - auto arg_idx = std::stoi(ph->arg.substr(1)); // "a0" -> 0 - assert(arg_idx < static_cast(all_args.size())); + auto arg_idx = ph->n; + assert(arg_idx < all_args.size()); auto *arg = all_args[arg_idx]; bool is_receiver = HasReceiver(expr) && arg_idx == 0; @@ -3593,7 +3593,7 @@ std::string Converter::ConvertIRFragment( .param_type = Mapper::GetParamType(GetCalleeOrExpr(expr), arg_idx), .materialize_ctx = ctx, .materialize_idx = - is_receiver ? -1 : (arg_idx - (HasReceiver(expr) ? 1 : 0)), + is_receiver ? -1 : ((int)arg_idx - HasReceiver(expr)), .access = ph->access, .is_receiver = is_receiver, .is_cpp_ptr = arg->getType()->isPointerType(), diff --git a/cpp2rust/converter/mapper.cpp b/cpp2rust/converter/mapper.cpp index bb08b0bb..476eabeb 100644 --- a/cpp2rust/converter/mapper.cpp +++ b/cpp2rust/converter/mapper.cpp @@ -7,10 +7,9 @@ #include #include -#include #include -#include #include +#include #include #include @@ -25,10 +24,10 @@ clang::ASTContext *ctx_ = nullptr; Model model_ = Model::kUnsafe; bool translation_rules_loaded_ = false; -std::unordered_map - exprs_; // src -> ExprTgt -std::unordered_map - types_; // src -> TypeTgt +std::unordered_multimap + exprs_; // src -> ExprRule +std::unordered_multimap + types_; // src -> TypeRule clang::PrintingPolicy getPrintPolicy() { assert(ctx_); @@ -41,6 +40,49 @@ clang::PrintingPolicy getPrintPolicy() { return policy; } +std::string GetExprMapKey(const std::string &str) { + // Extract the function name from something like + // const T1 & std::foo::fn_name(args) + auto n = str.find_first_of('('); + if (n == std::string::npos) { + n = str.size(); + } + + // Walk backwards from '(' tracking <> depth: + // - skip characters inside template arguments (depth > 0) + // - stop at the first space outside all angle brackets + std::string result; + int depth = 0; + for (int i = (int)n - 1; i >= 0; --i) { + char c = str[i]; + if (c == '>') + ++depth; + else if (c == '<') + --depth; + else if (c == ' ' && depth == 0) + break; + else if (depth == 0) + result += c; + } + std::reverse(result.begin(), result.end()); + return result; +} + +std::string GetTypeMapKey(const std::string &str) { + auto n = str.find_first_of("<["); + if (n == std::string::npos || str[n] == '<') { + return str.substr(0, n); + } + // something like int[][] or T1[] -> [] + return str.substr(n + 1); +} + +void AddTypeRule(std::string src, TranslationRule::TypeRule &&rule) { + auto key = GetTypeMapKey(src); + rule.src = std::move(src); + types_.emplace(std::move(key), std::move(rule)); +} + // Attempts to unify an instantiated C++ type or function signature with a // corresponding template pattern. If the two match structurally, it returns // a mapping from template parameter names (e.g., "T1") to their concrete @@ -49,13 +91,12 @@ clang::PrintingPolicy getPrintPolicy() { // Example: // template_str = "std::vector::vector()" // instantiated = "std::vector::vector()" -// result = { {"T1", "int"} } -std::optional> +// result = { "int" } +std::optional> matchTemplate(const std::string &template_str, const std::string &instantiated) { auto matchLiteralAt = [&](const std::string &input_str, size_t pos, - const std::string &literal, - size_t &end_pos) -> bool { + std::string_view literal, size_t &end_pos) -> bool { size_t i = pos; size_t j = 0; @@ -87,7 +128,7 @@ matchTemplate(const std::string &template_str, }; auto findNextLiteralSameDepth = [&](const std::string &s, size_t start, - const std::string &lit) -> size_t { + std::string_view lit) -> size_t { int ang = 0; int par = 0; int sq = 0; @@ -178,7 +219,7 @@ matchTemplate(const std::string &template_str, return std::string::npos; }; - std::unordered_map captured; + std::vector captured; size_t ti = 0; size_t si = 0; @@ -192,10 +233,10 @@ matchTemplate(const std::string &template_str, tj++; } - std::string name = template_str.substr(ti, tj - ti); + size_t type_idx = std::stoi(&template_str[ti + 1]) - 1; ti = tj; - std::string nextLit; + std::string_view nextLit; size_t scan = ti; while (scan < template_str.size()) { if (template_str[scan] == 'T' && scan + 1 < template_str.size() && @@ -204,12 +245,13 @@ matchTemplate(const std::string &template_str, } scan++; } - nextLit = template_str.substr(ti, scan - ti); + nextLit = std::string_view(template_str).substr(ti, scan - ti); - auto [it, inserted] = captured.try_emplace(std::move(name)); - if (!inserted) { + captured.resize(std::max(captured.size(), type_idx + 1)); + auto &repl = captured[type_idx]; + if (!repl.empty()) { size_t end_pos = 0; - if (!matchLiteralAt(instantiated, si, it->second, end_pos)) { + if (!matchLiteralAt(instantiated, si, repl, end_pos)) { return std::nullopt; } si = end_pos; @@ -230,7 +272,7 @@ matchTemplate(const std::string &template_str, b--; } - it->second = instantiated.substr(a, b - a); + repl = instantiated.substr(a, b - a); si = k; } else { size_t a = si; @@ -243,7 +285,7 @@ matchTemplate(const std::string &template_str, b--; } - it->second = instantiated.substr(a, b - a); + repl = instantiated.substr(a, b - a); si = instantiated.size(); } } @@ -263,10 +305,10 @@ matchTemplate(const std::string &template_str, std::isdigit(template_str[tj + 1])) { break; } - tj++; + ++tj; } - std::string lit = template_str.substr(ti, tj - ti); + auto lit = std::string_view(template_str).substr(ti, tj - ti); size_t end_pos = 0; if (!matchLiteralAt(instantiated, si, lit, end_pos)) { return std::nullopt; @@ -292,126 +334,88 @@ matchTemplate(const std::string &template_str, // corresponding instantiated type from `types`. // // Example: -// types = { {"T1", "i32"} } +// types = { {"i32"} } // tgt_template = "Vec" // result = "Vec" -std::string -instantiateTgt(const std::unordered_map &types, - const std::string &tgt_template) { +std::string instantiateTgt(const std::vector &types, + const std::string &tgt_template) { + assert(types.size() <= 9); std::string instantiated_template = tgt_template; - for (const auto &[key, value] : types) { - std::string::size_type pos = 0; - while ((pos = instantiated_template.find(key, pos)) != std::string::npos) { - instantiated_template.replace(pos, key.length(), value); - pos += value.length(); + std::string::size_type pos = 0; + while ((pos = instantiated_template.find('T', pos)) != std::string::npos) { + if (pos + 1 >= instantiated_template.size()) { + break; } + if (!std::isdigit(instantiated_template[pos + 1])) { + ++pos; + continue; + } + auto &repl = types.at(instantiated_template[pos + 1] - '1'); + instantiated_template.replace(pos, 2, repl); + pos += repl.length(); } return instantiated_template; } -template -Map::const_iterator parallel_search(const Map &container, - MatchPred &&match_func) { - if (container.empty()) { - return container.cend(); - } - - auto tie_breaker = [](const std::string &a, const std::string &b) -> bool { - if (a.size() != b.size()) { - // Match more specific rules first (usually the longer ones). - return a.size() > b.size(); +template +std::pair> +search(std::unordered_multimap &map, const std::string &txt, + const std::string &key) { + auto [it, end] = map.equal_range(key); + T *rule = nullptr; + std::vector subs; + + for (; it != end; ++it) { + auto &this_rule = it->second; + auto this_subs = matchTemplate(this_rule.src, txt); + if (!this_subs) { + continue; } - return a < b; // Lexicographically - }; - - const unsigned hw = std::max(1u, std::thread::hardware_concurrency()); - const unsigned nthreads = - std::min(hw, std::max(1, container.bucket_count())); - - std::atomic next_bucket{0}; - std::mutex hit_mtx; - std::optional hit_key; - - auto worker = [&](unsigned) { - while (true) { - size_t b = next_bucket.fetch_add(1, std::memory_order_relaxed); - if (b >= container.bucket_count()) { - break; - } - - for (auto it = container.cbegin(b); it != container.cend(b); ++it) { - if (!match_func(it->first)) { - continue; - } - - std::scoped_lock lk(hit_mtx); - if (!hit_key || tie_breaker(it->first, *hit_key)) { - hit_key = it->first; - } - } + // tie breaker: prefer more specific rules (usually the longer ones) + if (!rule || this_rule.src.size() > rule->src.size()) { + rule = &this_rule; + subs = *std::move(this_subs); } - }; - - { - llvm::DefaultThreadPool pool( - llvm::heavyweight_hardware_concurrency(nthreads)); - for (unsigned t = 0; t < nthreads; ++t) - pool.async(worker, t); - pool.wait(); } - - return hit_key ? container.find(*hit_key) : container.cend(); + return {rule, std::move(subs)}; } -decltype(exprs_)::const_iterator search(const clang::Expr *expr) { +TranslationRule::ExprRule *search(const clang::Expr *expr) { auto qualified_name = ToString(expr); - auto result = parallel_search(exprs_, [&](const std::string &tpl) { - return matchTemplate(tpl, qualified_name); - }); + auto [rule, subs] = + search(exprs_, qualified_name, GetExprMapKey(qualified_name)); llvm::errs() << "search expr " << qualified_name << ", result:\n"; - if (result != exprs_.end()) { - result->second.dump(); + if (rule) { + rule->dump(); } else { llvm::errs() << "None\n"; } - return result; + return rule; } -decltype(types_)::const_iterator search(clang::QualType qual_type) { +TranslationRule::TypeRule *search(clang::QualType qual_type) { auto type = ToString(qual_type); - auto result = parallel_search( - types_, [&](const std::string &tpl) { return matchTemplate(tpl, type); }); - llvm::errs() << "search type " << type << ", result: " - << ((result == types_.end()) ? "None" - : result->second.type_info.type) + auto [rule, subs] = search(types_, type, GetTypeMapKey(type)); + llvm::errs() << "search type " << type + << ", result: " << (rule ? rule->type_info.type : "None") << '\n'; - return result; + return rule; } void addRulesFromDirectory(const std::filesystem::path &dir, Model model) { for (const auto &entry : std::filesystem::recursive_directory_iterator(dir)) { auto &path = entry.path(); if (entry.is_regular_file() && path.extension() == ".cpp") { - auto rules = TranslationRule::Load(path, model); - if (rules.empty()) { + auto [expr_rules, type_rules] = TranslationRule::Load(path, model); + if (expr_rules.empty() && type_rules.empty()) { llvm::errs() << "No rules found in " << path << '\n'; continue; } - for (auto &rule : rules) { - if (auto *expr = std::get_if(&rule.tgt)) { - if (!exprs_.try_emplace(std::move(rule.src), std::move(*expr)) - .second) { - llvm::errs() << "Key: " << rule.src << " already exists in exprs\n"; - assert(0); - } - } else if (auto *type = - std::get_if(&rule.tgt)) { - if (!types_.try_emplace(std::move(rule.src), std::move(*type)) - .second) { - llvm::errs() << "Key: " << rule.src << " already exists in types\n"; - assert(0); - } - } + for (auto &[_, rule] : expr_rules) { + exprs_.emplace(GetExprMapKey(rule.src), std::move(rule)); + } + for (auto &[_, rule] : type_rules) { + types_.emplace(GetTypeMapKey(rule.src), std::move(rule)); } } } @@ -422,20 +426,21 @@ void addBuiltinTypes(Model model) { auto add_builtin_rule = [&](clang::QualType qt, const std::string &rust) { auto cxx = ToString(qt); - types_[cxx] = TranslationRule::TypeTgt::Plain(rust); - types_["const " + cxx] = TranslationRule::TypeTgt::Plain(rust); + AddTypeRule(cxx, TranslationRule::TypeRule::Plain(rust)); + AddTypeRule("const " + cxx, TranslationRule::TypeRule::Plain(rust)); switch (model) { case Model::kUnsafe: - types_[cxx + " *"] = TranslationRule::TypeTgt::UnsafePtr("*mut " + rust); - types_["const " + cxx + " *"] = - TranslationRule::TypeTgt::UnsafePtr("*const " + rust); + AddTypeRule(cxx + " *", + TranslationRule::TypeRule::UnsafePtr("*mut " + rust)); + AddTypeRule("const " + cxx + " *", + TranslationRule::TypeRule::UnsafePtr("*const " + rust)); break; case Model::kRefCount: - types_[cxx + " *"] = - TranslationRule::TypeTgt::RefcountPtr("Ptr::<" + rust + ">"); - types_["const " + cxx + " *"] = - TranslationRule::TypeTgt::RefcountPtr("Ptr::<" + rust + ">"); + AddTypeRule(cxx + " *", TranslationRule::TypeRule::RefcountPtr( + "Ptr::<" + rust + ">")); + AddTypeRule("const " + cxx + " *", TranslationRule::TypeRule::RefcountPtr( + "Ptr::<" + rust + ">")); break; } }; @@ -453,16 +458,16 @@ void addBuiltinTypes(Model model) { switch (model) { case Model::kUnsafe: - types_[ToString(ctx_->VoidTy) + " *"] = - TranslationRule::TypeTgt::UnsafePtr("*mut ::libc::c_void"); - types_["const " + ToString(ctx_->VoidTy) + " *"] = - TranslationRule::TypeTgt::UnsafePtr("*const ::libc::c_void"); + AddTypeRule(ToString(ctx_->VoidTy) + " *", + TranslationRule::TypeRule::UnsafePtr("*mut ::libc::c_void")); + AddTypeRule("const " + ToString(ctx_->VoidTy) + " *", + TranslationRule::TypeRule::UnsafePtr("*const ::libc::c_void")); break; case Model::kRefCount: - types_[ToString(ctx_->VoidTy) + " *"] = - TranslationRule::TypeTgt::RefcountPtr("AnyPtr"); - types_["const " + ToString(ctx_->VoidTy) + " *"] = - TranslationRule::TypeTgt::RefcountPtr("AnyPtr"); + AddTypeRule(ToString(ctx_->VoidTy) + " *", + TranslationRule::TypeRule::RefcountPtr("AnyPtr")); + AddTypeRule("const " + ToString(ctx_->VoidTy) + " *", + TranslationRule::TypeRule::RefcountPtr("AnyPtr")); break; } @@ -528,25 +533,23 @@ clang::QualType normalizeQualType(clang::QualType qual_type) { } std::string mapTypeStringRecursive(const std::string &cpp_type) { - auto rule = parallel_search(types_, [&](const std::string &tpl) { - return matchTemplate(tpl, cpp_type); - }); - if (rule == types_.end()) { + auto [rule, subs] = search(types_, cpp_type, GetTypeMapKey(cpp_type)); + if (!rule) { llvm::errs() << "cpp_type: " << cpp_type << '\n'; assert(0 && "Type is not present in types_"); } - auto subs = matchTemplate(rule->first, cpp_type).value(); - for (auto &kv : subs) { - kv.second = mapTypeStringRecursive(kv.second); + for (auto &ty : subs) { + ty = mapTypeStringRecursive(ty); } - return instantiateTgt(subs, rule->second.type_info.type); + return instantiateTgt(subs, rule->type_info.type); } std::string normalizeTranslationRule(std::string rule) { - const std::array, 2> normalization_rules{{ - // Detach pointer from double reference. Useful for matching translation - // rules. - {std::regex(R"(\*\&\&)"), "* &&"}, + // Detach pointer from double reference. Useful for matching translation + // rules. + rule = ReplaceAll(rule, "*&&", "* &&"); + + const std::array, 1> normalization_rules{{ // Ignore constant template parameters, i.e. replace them with _. {std::regex(R"(\b\d+\b)"), "_"}, }}; @@ -578,90 +581,78 @@ PushASTContext::PushASTContext(clang::ASTContext &ctx) : prev_(ctx_) { PushASTContext::~PushASTContext() { ctx_ = prev_; } bool Contains(clang::QualType qual_type) { - return search(qual_type) != types_.end(); + return search(qual_type) != nullptr; } -bool Contains(const clang::Expr *expr) { return search(expr) != exprs_.end(); } +bool Contains(const clang::Expr *expr) { return search(expr) != nullptr; } -const TranslationRule::ExprTgt *GetExprTgt(const clang::Expr *expr) { - if (auto it = search(expr); it != exprs_.end()) { - return &it->second; - } - return nullptr; +const TranslationRule::ExprRule *GetExprRule(const clang::Expr *expr) { + return search(expr); } std::string MapFunctionName(const clang::FunctionDecl *decl) { assert(decl); - if (exprs_.contains(ToString(decl))) { + if (exprs_.contains(GetExprMapKey(ToString(decl)))) { return std::format("libcc2rs::{}_{}", decl->getNameAsString(), model_ == Model::kRefCount ? "refcount" : "unsafe"); } return GetNamedDeclAsString(decl->getCanonicalDecl()); } -std::string InstantiateTemplate(const clang::Expr *expr, - const std::string &text) { - auto it = search(expr); - if (it == exprs_.end()) { +std::string InstantiateTemplate(const clang::Expr *expr, unsigned n) { + auto expr_str = ToString(expr); + auto [rule, subs] = search(exprs_, expr_str, GetExprMapKey(expr_str)); + auto text = std::format("T{}", n); + if (!rule) { return text; } - auto types_map = matchTemplate(it->first, ToString(expr)).value(); - for (auto &kv : types_map) { - kv.second = mapTypeStringRecursive(kv.second); + for (auto &ty : subs) { + ty = mapTypeStringRecursive(ty); } - return instantiateTgt(types_map, text); + return instantiateTgt(subs, text); } std::string Map(clang::QualType qual_type) { - if (auto it = search(qual_type); it != types_.end()) { - auto types_map = matchTemplate(it->first, ToString(qual_type)).value(); - for (auto &kv : types_map) { - kv.second = mapTypeStringRecursive(kv.second); + auto type_str = ToString(qual_type); + auto [rule, subs] = search(types_, type_str, GetTypeMapKey(type_str)); + if (rule) { + for (auto &ty : subs) { + ty = mapTypeStringRecursive(ty); } - return instantiateTgt(types_map, it->second.type_info.type); + return instantiateTgt(subs, rule->type_info.type); } return {}; } bool MapsToPointer(clang::QualType qual_type) { - if (auto it = search(qual_type); it != types_.end()) { - return it->second.type_info.is_pointer(); - } - return false; + auto rule = search(qual_type); + return rule && rule->type_info.is_pointer(); } bool MapsToRefcountPointer(clang::QualType qual_type) { - if (auto it = search(qual_type); it != types_.end()) { - return it->second.type_info.is_refcount_pointer; - } - return false; + auto rule = search(qual_type); + return rule && rule->type_info.is_refcount_pointer; } bool ReturnsPointer(const clang::Expr *expr) { - if (auto it = search(expr); it != exprs_.end()) { - return it->second.return_type.is_pointer(); - } - return false; + auto rule = search(expr); + return rule && rule->return_type.is_pointer(); } const TranslationRule::TypeInfo &GetParamInfo(const clang::Expr *expr, unsigned index) { - auto name = "a" + std::to_string(index); - auto it = search(expr); - assert(it != exprs_.end() && "expression must have a translation rule"); - auto name_it = it->second.params.find(name); - assert(name_it != it->second.params.end() && - "placeholder arg must have a corresponding param type in IR"); - return name_it->second; + auto rule = search(expr); + assert(rule && "expression must have a translation rule"); + return rule->params.at(index); } std::string GetParamType(const clang::Expr *expr, unsigned index) { - auto &info = GetParamInfo(expr, index); - auto types_map = matchTemplate(search(expr)->first, ToString(expr)).value(); - for (auto &kv : types_map) { - kv.second = mapTypeStringRecursive(kv.second); + auto expr_str = ToString(expr); + auto [rule, subs] = search(exprs_, expr_str, GetExprMapKey(expr_str)); + for (auto &ty : subs) { + ty = mapTypeStringRecursive(ty); } - return instantiateTgt(types_map, info.type); + return instantiateTgt(subs, rule->params.at(index).type); } bool ParamIsPointer(const clang::Expr *expr, unsigned index) { @@ -672,10 +663,7 @@ void AddRuleForUserDefinedType(clang::NamedDecl *decl) { auto cpp_name = ToString(decl); auto rs_name = ReplaceAll(cpp_name, "::", "_"); - if (!types_.try_emplace(cpp_name, TranslationRule::TypeTgt::Plain(rs_name)) - .second) { - return; - } + AddTypeRule(cpp_name, TranslationRule::TypeRule::Plain(rs_name)); if (auto record_decl = llvm::dyn_cast(decl)) { // Forward declaration @@ -687,23 +675,23 @@ void AddRuleForUserDefinedType(clang::NamedDecl *decl) { if (cxx_decl->isAbstract()) { switch (model_) { case Model::kUnsafe: - types_[cpp_name + " *"] = - TranslationRule::TypeTgt::UnsafePtr("*mut dyn " + rs_name); + AddTypeRule(cpp_name + " *", TranslationRule::TypeRule::UnsafePtr( + "*mut dyn " + rs_name)); break; case Model::kRefCount: - types_[cpp_name + " *"] = TranslationRule::TypeTgt::RefcountPtr( - "PtrDyn'); + AddTypeRule(cpp_name + " *", TranslationRule::TypeRule::RefcountPtr( + "PtrDyn')); break; } } else { switch (model_) { case Model::kUnsafe: - types_[cpp_name + " *"] = - TranslationRule::TypeTgt::UnsafePtr("*mut " + rs_name); + AddTypeRule(cpp_name + " *", + TranslationRule::TypeRule::UnsafePtr("*mut " + rs_name)); break; case Model::kRefCount: - types_[cpp_name + " *"] = - TranslationRule::TypeTgt::RefcountPtr("Ptr<" + rs_name + '>'); + AddTypeRule(cpp_name + " *", TranslationRule::TypeRule::RefcountPtr( + "Ptr<" + rs_name + '>')); break; } } @@ -765,7 +753,7 @@ std::string ToString(const clang::NamedDecl *decl) { return normalizeTranslationRule(std::move(out)); } - os << ToString(func_decl->getReturnType()) << " "; + os << ToString(func_decl->getReturnType()) << ' '; if (const auto *method_decl = llvm::dyn_cast(func_decl)) { if (method_decl->getParent()->isLambda() && @@ -896,13 +884,13 @@ void LoadTranslationRules(Model model, clang::ASTContext &ctx, addBuiltinTypes(model); #if 0 - for (auto &[src, expr] : exprs_) { - llvm::errs() << "Expr: " << src << '\n'; - expr.dump(); + for (auto &[src, rule] : exprs_) { + llvm::errs() << "Expr key: " << src << '\n'; + rule.dump(); } - for (auto &[src, type_tgt] : types_) { - llvm::errs() << "Type: " << src << '\n'; - type_tgt.dump(); + for (auto &[src, rule] : types_) { + llvm::errs() << "Type key: " << src << '\n'; + rule.dump(); } #endif } diff --git a/cpp2rust/converter/mapper.h b/cpp2rust/converter/mapper.h index 19adf3cb..942a39a9 100644 --- a/cpp2rust/converter/mapper.h +++ b/cpp2rust/converter/mapper.h @@ -7,9 +7,7 @@ #include #include -#include #include -#include #include "converter/factory.h" #include "converter/translation_rule.h" @@ -30,10 +28,9 @@ bool Contains(clang::QualType qual_type); bool Contains(const clang::Expr *expr); std::string Map(clang::QualType qual_type); -const TranslationRule::ExprTgt *GetExprTgt(const clang::Expr *expr); +const TranslationRule::ExprRule *GetExprRule(const clang::Expr *expr); std::string MapFunctionName(const clang::FunctionDecl *decl); -std::string InstantiateTemplate(const clang::Expr *expr, - const std::string &text); +std::string InstantiateTemplate(const clang::Expr *expr, unsigned n); bool ReturnsPointer(const clang::Expr *expr); std::string GetParamType(const clang::Expr *expr, unsigned index); bool ParamIsPointer(const clang::Expr *expr, unsigned index); diff --git a/cpp2rust/converter/models/converter_refcount.cpp b/cpp2rust/converter/models/converter_refcount.cpp index 561bb1bb..9d97aa30 100644 --- a/cpp2rust/converter/models/converter_refcount.cpp +++ b/cpp2rust/converter/models/converter_refcount.cpp @@ -2194,7 +2194,7 @@ std::string ConverterRefCount::ConvertMappedMethodCall( return Converter::ConvertMappedMethodCall(expr, mc, args, num_args, ctx); } - auto arg_idx = std::stoi(receiver_ph->arg.substr(1)); + auto arg_idx = receiver_ph->n; auto *arg = BuildUnifiedArgs(expr, args, num_args)[arg_idx]; if (!arg->getType()->isPointerType() && !IsReferenceType(arg)) { diff --git a/cpp2rust/converter/translation_rule.cpp b/cpp2rust/converter/translation_rule.cpp index b39bb178..34315f73 100644 --- a/cpp2rust/converter/translation_rule.cpp +++ b/cpp2rust/converter/translation_rule.cpp @@ -23,7 +23,6 @@ #include #include -#include #include #include @@ -75,11 +74,13 @@ struct LookupInfo { } }; -using RuleMap = std::unordered_map; +using ExprRules = cpp2rust::TranslationRule::ExprRules; +using TypeRules = cpp2rust::TranslationRule::TypeRules; class Callback : public clang::ast_matchers::MatchFinder::MatchCallback { public: - explicit Callback(RuleMap &out) : out_(out) {} + explicit Callback(ExprRules &exprs, TypeRules &types) + : exprs_(exprs), types_(types) {} void init(clang::Sema &sema) { sema_ = &sema; @@ -97,19 +98,13 @@ class Callback : public clang::ast_matchers::MatchFinder::MatchCallback { } else { type = var->getUnderlyingType(); } - - Rule rule; - rule.src = Mapper::ToString(type); - out_[var->getQualifiedNameAsString()] = std::move(rule); + types_.at(var->getQualifiedNameAsString()).src = Mapper::ToString(type); return; } if (auto func = R.Nodes.getNodeAs("func")) { - auto sym = func->getQualifiedNameAsString(); - auto add = [&](std::string src) { - Rule rule; - rule.src = std::move(src); - out_[sym] = std::move(rule); + auto add = [&](std::string &&src) { + exprs_.at(func->getQualifiedNameAsString()).src = std::move(src); }; if (const auto *fcall = R.Nodes.getNodeAs("fcall")) { @@ -184,7 +179,8 @@ class Callback : public clang::ast_matchers::MatchFinder::MatchCallback { } private: - RuleMap &out_; + ExprRules &exprs_; + TypeRules &types_; clang::Sema *sema_ = nullptr; clang::SourceLocation loc_; @@ -660,7 +656,8 @@ class Callback : public clang::ast_matchers::MatchFinder::MatchCallback { class ActionFactory : public clang::tooling::FrontendActionFactory { public: - explicit ActionFactory(RuleMap &out) : cb_(out) { + explicit ActionFactory(ExprRules &exprs, TypeRules &types) + : cb_(exprs, types) { using namespace clang::ast_matchers; finder_.addMatcher( returnStmt( @@ -733,14 +730,6 @@ class ActionFactory : public clang::tooling::FrontendActionFactory { Callback cb_; }; -TextFragment ParseTextFragmentJSON(const llvm::json::Object &obj) { - return {obj.getString("text")->str()}; -} - -GenericFragment ParseGenericFragmentJSON(const llvm::json::Object &obj) { - return {obj.getString("generic")->str()}; -} - TypeInfo ParseTypeInfoJSON(const llvm::json::Object &obj) { TypeInfo info; if (auto ty = obj.getString("type")) @@ -769,10 +758,8 @@ Access ParseAccessJSON(llvm::StringRef value) { PlaceholderFragment ParsePlaceholderFragmentJSON(const llvm::json::Object &obj) { - auto arg = obj.getString("arg"); auto access = obj.getString("access"); - assert(arg && access); - return {arg->str(), ParseAccessJSON(*access)}; + return {(unsigned)*obj.getInteger("arg"), ParseAccessJSON(*access)}; } std::vector ParseBodyFragmentsJSON(const llvm::json::Array &arr); @@ -794,10 +781,10 @@ std::vector ParseBodyFragmentsJSON(const llvm::json::Array &arr) { auto *frag_obj = frag.getAsObject(); if (!frag_obj) continue; - if (frag_obj->getString("text")) { - result.push_back(ParseTextFragmentJSON(*frag_obj)); - } else if (frag_obj->getString("generic")) { - result.push_back(ParseGenericFragmentJSON(*frag_obj)); + if (auto str = frag_obj->getString("text")) { + result.push_back(TextFragment{str->str()}); + } else if (auto n = frag_obj->getInteger("generic")) { + result.push_back(GenericFragment{(unsigned)*n}); } else if (auto *ph = frag_obj->getObject("placeholder")) { result.push_back(ParsePlaceholderFragmentJSON(*ph)); } else if (auto *mc = frag_obj->getObject("method_call")) { @@ -808,13 +795,16 @@ std::vector ParseBodyFragmentsJSON(const llvm::json::Array &arr) { return result; } -ExprTgt ParseExprTgtJSON(const llvm::json::Object &obj) { - ExprTgt ir; +ExprRule ParseExprRuleJSON(const llvm::json::Object &obj) { + ExprRule ir; if (auto *params = obj.getObject("params")) { for (auto &[key, val] : *params) { - if (auto *param_obj = val.getAsObject()) - ir.params[key.str()] = ParseTypeInfoJSON(*param_obj); + if (auto *param_obj = val.getAsObject()) { + size_t id = atoi(llvm::StringRef(key).data() + 1); + ir.params.resize(std::max(ir.params.size(), id + 1)); + ir.params[id] = ParseTypeInfoJSON(*param_obj); + } } } @@ -832,7 +822,9 @@ ExprTgt ParseExprTgtJSON(const llvm::json::Object &obj) { if (auto s = b.getAsString()) bounds.push_back(s->str()); } - ir.generics[key.str()] = std::move(bounds); + size_t id = atoi(llvm::StringRef(key).data() + 1) - 1; // starts in T1 + ir.generics.resize(std::max(ir.generics.size(), id + 1)); + ir.generics[id] = std::move(bounds); } } } @@ -844,48 +836,40 @@ ExprTgt ParseExprTgtJSON(const llvm::json::Object &obj) { return ir; } -TypeTgt ParseTypeTgtJSON(const llvm::json::Object &obj) { - TypeTgt tgt; +TypeRule ParseTypeRuleJSON(const llvm::json::Object &obj) { + TypeRule rule; if (auto init = obj.getString("init")) - tgt.initializer = init->str(); - tgt.type_info = ParseTypeInfoJSON(obj); - return tgt; + rule.initializer = init->str(); + rule.type_info = ParseTypeInfoJSON(obj); + return rule; } -RuleMap LoadSrc(const std::filesystem::path &src_path) { +void LoadSrc(ExprRules &exprs, TypeRules &types, + const std::filesystem::path &src_path) { clang::tooling::FixedCompilationDatabase compilations( ".", getPlatformClangFlags()); - RuleMap out; - ActionFactory factory(out); + ActionFactory factory(exprs, types); clang::tooling::ClangTool tool(compilations, {src_path.string()}); tool.run(&factory); - - if (out.empty()) { - llvm::errs() << "Warning: no symbols found in return statements for file: " - << src_path << '\n'; - return out; - } - return out; } -RuleMap LoadTgtFromIR(const std::filesystem::path &json_path) { - RuleMap out; - +void LoadTgtFromIR(ExprRules &exprs, TypeRules &types, + const std::filesystem::path &json_path) { auto buf = llvm::MemoryBuffer::getFile(json_path.string()); if (!buf) - return out; + return; auto parsed = llvm::json::parse((*buf)->getBuffer()); if (!parsed) { llvm::errs() << "Failed to parse IR JSON: " << json_path << ": " << llvm::toString(parsed.takeError()) << '\n'; assert(0); - return out; + return; } auto *root = parsed->getAsObject(); if (!root) - return out; + return; for (auto &[entry_name, entry_val] : *root) { auto *obj = entry_val.getAsObject(); @@ -893,44 +877,10 @@ RuleMap LoadTgtFromIR(const std::filesystem::path &json_path) { continue; auto name = entry_name.str(); - Rule rule; if (name[0] == 'f') { - rule.tgt = ParseExprTgtJSON(*obj); - std::get(rule.tgt).validate(json_path.string() + ":" + name); + exprs[std::move(name)] = ParseExprRuleJSON(*obj); } else if (name[0] == 't') { - rule.tgt = ParseTypeTgtJSON(*obj); - } else { - continue; - } - out[name] = std::move(rule); - } - - return out; -} - -template -void ValidateConsecutiveKeys(const Map &map, char prefix, int start, - const std::string &label) { - std::vector indices; - for (auto &[key, _] : map) { - if (key.size() < 2 || key[0] != prefix || - !std::all_of(key.begin() + 1, key.end(), ::isdigit)) { - llvm::errs() << label << ": invalid name '" << key << "', expected " - << prefix << start << ", " << prefix << (start + 1) << ", " - << prefix << (start + 2) << ", ...\n"; - assert(0 && "names must follow expected pattern"); - } - indices.push_back(std::stoi(key.substr(1))); - } - std::sort(indices.begin(), indices.end()); - for (size_t i = 0; i < indices.size(); ++i) { - if (indices[i] != static_cast(i) + start) { - llvm::errs() << label << ": not consecutive. Got:"; - for (auto idx : indices) { - llvm::errs() << " " << prefix << idx; - } - llvm::errs() << '\n'; - assert(0 && "indices must be consecutive"); + types[std::move(name)] = ParseTypeRuleJSON(*obj); } } } @@ -955,16 +905,16 @@ void TextFragment::dump() const { } void PlaceholderFragment::dump() const { - llvm::errs() << " placeholder: " << arg << " ("; + llvm::errs() << " placeholder: " << n; switch (access) { case Access::kRead: - llvm::errs() << "read\n"; + llvm::errs() << " (read)\n"; break; case Access::kWrite: - llvm::errs() << "write\n"; + llvm::errs() << " (write)\n"; break; case Access::kMove: - llvm::errs() << "move\n"; + llvm::errs() << " (move)\n"; break; } } @@ -990,9 +940,11 @@ void MethodCallFragment::dump() const { } } -void ExprTgt::dump() const { - for (auto &[name, info] : params) { - llvm::errs() << " param " << name << ": "; +void ExprRule::dump() const { + llvm::errs() << "Matching: " << src << '\n'; + unsigned i = 0; + for (auto &info : params) { + llvm::errs() << " param a" << i++ << ": "; info.dump(); llvm::errs() << '\n'; } @@ -1001,10 +953,11 @@ void ExprTgt::dump() const { return_type.dump(); llvm::errs() << '\n'; } - for (auto &[name, bounds] : generics) { - llvm::errs() << " generic " << name << ":"; + i = 0; + for (auto &bounds : generics) { + llvm::errs() << " generic T" << ++i << ':'; for (auto &b : bounds) { - llvm::errs() << " " << b; + llvm::errs() << ' ' << b; } llvm::errs() << '\n'; } @@ -1014,7 +967,7 @@ void ExprTgt::dump() const { } void GenericFragment::dump() const { - llvm::errs() << " generic: " << name << '\n'; + llvm::errs() << " generic: " << n << '\n'; } void TypeInfo::dump() const { @@ -1025,8 +978,8 @@ void TypeInfo::dump() const { llvm::errs() << " [unsafe_ptr]"; } -void TypeTgt::dump() const { - llvm::errs() << " type: "; +void TypeRule::dump() const { + llvm::errs() << "name: " << src << "\n Rust type: "; type_info.dump(); llvm::errs() << '\n'; if (!initializer.empty()) { @@ -1034,49 +987,37 @@ void TypeTgt::dump() const { } } -void ExprTgt::validate(const std::string &context) const { - ValidateConsecutiveKeys(params, 'a', 0, context + " params"); - ValidateConsecutiveKeys(generics, 'T', 1, context + " generics"); - assert(!body.empty() && "ExprTgt body must not be empty"); -} - -std::vector Load(const std::filesystem::path &path, Model model) { +std::pair Load(const std::filesystem::path &path, + Model model) { + ExprRules exprs; + TypeRules types; auto dir = path.parent_path(); - auto unsafe_ir_path = dir / "ir_unsafe.json"; - auto refcount_ir_path = dir / "ir_refcount.json"; - - auto rules = LoadTgtFromIR(unsafe_ir_path); + LoadTgtFromIR(exprs, types, dir / "ir_unsafe.json"); - if (model == Model::kRefCount && std::filesystem::exists(refcount_ir_path)) { - auto refcount = LoadTgtFromIR(refcount_ir_path); - for (auto &[name, rule] : refcount) { - rules[name] = std::move(rule); + if (model == Model::kRefCount) { + auto refcount_ir_path = dir / "ir_refcount.json"; + if (std::filesystem::exists(refcount_ir_path)) { + LoadTgtFromIR(exprs, types, refcount_ir_path); } } - auto src_rules = LoadSrc(path); - if (src_rules.empty()) { - return {}; - } - for (auto &[name, src_rule] : src_rules) { - rules.at(name).src = std::move(src_rule.src); - } + LoadSrc(exprs, types, path); - std::vector result; - for (auto &[name, rule] : rules) { + for (auto &[name, rule] : exprs) { if (rule.src.empty()) { llvm::errs() << name << '\n'; - if (const auto *tgt = std::get_if(&rule.tgt)) { - tgt->dump(); - } - if (const auto *tgt = std::get_if(&rule.tgt)) { - tgt->dump(); - } + rule.dump(); + assert(0 && "Expr rule loaded from IR but has no src"); } - assert(!rule.src.empty() && "Rule loaded from IR but has no src"); - result.push_back(std::move(rule)); } - return result; + for (auto &[name, rule] : types) { + if (rule.src.empty()) { + llvm::errs() << name << '\n'; + rule.dump(); + assert(0 && "Type rule loaded from IR but has no src"); + } + } + return {std::move(exprs), std::move(types)}; } } // namespace cpp2rust::TranslationRule diff --git a/cpp2rust/converter/translation_rule.h b/cpp2rust/converter/translation_rule.h index 566dd900..91ac72f9 100644 --- a/cpp2rust/converter/translation_rule.h +++ b/cpp2rust/converter/translation_rule.h @@ -24,14 +24,14 @@ struct TextFragment { enum class Access { kRead, kWrite, kMove }; struct PlaceholderFragment { - std::string arg; // "a0", "a1", ... + unsigned n; // "a0", "a1", ... Access access; void dump() const; }; struct GenericFragment { - std::string name; // "T1", "T2", ... + unsigned n; // "T1", "T2", ... void dump() const; }; @@ -60,39 +60,38 @@ struct TypeInfo { void dump() const; }; -struct ExprTgt { - std::unordered_map params; // "a0" -> TypeInfo +struct ExprRule { + std::string src; + std::vector params; TypeInfo return_type; - std::unordered_map> - generics; // "T1" -> ["Ord", "Clone"] + std::vector> generics; // "T1" -> ["Ord", "Clone"] std::vector body; bool multi_statement = false; void dump() const; - void validate(const std::string &context) const; }; -struct TypeTgt { +struct TypeRule { + std::string src; std::string initializer; // Rust initializer expression TypeInfo type_info; void dump() const; - static TypeTgt Plain(std::string type) { - return {{}, {std::move(type), false, false}}; + static TypeRule Plain(std::string type) { + return {{}, {}, {std::move(type), false, false}}; } - static TypeTgt RefcountPtr(std::string type) { - return {{}, {std::move(type), true, false}}; + static TypeRule RefcountPtr(std::string type) { + return {{}, {}, {std::move(type), true, false}}; } - static TypeTgt UnsafePtr(std::string type) { - return {{}, {std::move(type), false, true}}; + static TypeRule UnsafePtr(std::string type) { + return {{}, {}, {std::move(type), false, true}}; } }; -struct Rule { - std::string src; - std::variant tgt; -}; +using ExprRules = std::unordered_map; +using TypeRules = std::unordered_map; -std::vector Load(const std::filesystem::path &path, Model model); +std::pair Load(const std::filesystem::path &path, + Model model); } // namespace cpp2rust::TranslationRule diff --git a/rule-preprocessor/src/ir.rs b/rule-preprocessor/src/ir.rs index 73463ee0..03be4230 100644 --- a/rule-preprocessor/src/ir.rs +++ b/rule-preprocessor/src/ir.rs @@ -121,7 +121,7 @@ pub struct TypeIr { pub enum BodyFragment { Text { text: String }, Placeholder { placeholder: PlaceholderInner }, - Generic { generic: String }, + Generic { generic: i32 }, MethodCall { method_call: MethodCallInner }, } @@ -136,7 +136,7 @@ pub enum Access { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct PlaceholderInner { - pub arg: String, + pub arg: i32, pub access: Access, } @@ -168,7 +168,9 @@ fn resolve_nth_unknown(body: &mut [BodyFragment], param: &str, access: Access, n ) -> bool { for frag in body { match frag { - BodyFragment::Placeholder { placeholder } if placeholder.arg == param => { + BodyFragment::Placeholder { placeholder } + if placeholder.arg == param[1..].parse().unwrap_or(0) => + { if *count == nth { if placeholder.access == Access::Unknown { placeholder.access = access; diff --git a/rule-preprocessor/src/syntactic.rs b/rule-preprocessor/src/syntactic.rs index fd3e9311..a535c42a 100644 --- a/rule-preprocessor/src/syntactic.rs +++ b/rule-preprocessor/src/syntactic.rs @@ -194,7 +194,7 @@ impl<'a> FragmentCtx<'a> { self.flush_text(); self.fragments.push(BodyFragment::Placeholder { placeholder: PlaceholderInner { - arg: token.text().to_string(), + arg: token.text()[1..].parse().unwrap_or(0), access, }, }); @@ -203,7 +203,9 @@ impl<'a> FragmentCtx<'a> { let text = token.text().to_string(); if self.generic_names.contains(&text) { self.flush_text(); - self.fragments.push(BodyFragment::Generic { generic: text }); + self.fragments.push(BodyFragment::Generic { + generic: text[1..].parse().unwrap_or(0), + }); return; } } diff --git a/rules/algorithm/ir_refcount.json b/rules/algorithm/ir_refcount.json index 8844f902..c1225061 100644 --- a/rules/algorithm/ir_refcount.json +++ b/rules/algorithm/ir_refcount.json @@ -6,7 +6,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -20,7 +20,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -62,7 +62,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -71,7 +71,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -83,7 +83,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -103,7 +103,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -123,7 +123,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -143,7 +143,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -177,7 +177,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -364,7 +364,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -381,7 +381,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -393,7 +393,7 @@ "receiver": [ { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } } @@ -471,7 +471,7 @@ "receiver": [ { "placeholder": { - "arg": "a2", + "arg": 2, "access": "write" } } @@ -488,7 +488,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -499,7 +499,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -534,7 +534,7 @@ "receiver": [ { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } } @@ -579,20 +579,20 @@ "text": "let fun = |x: Ptr<" }, { - "generic": "T1" + "generic": 1 }, { "text": ">, y: Ptr<" }, { - "generic": "T1" + "generic": 1 }, { "text": ">| " }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -672,7 +672,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -686,7 +686,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -736,20 +736,20 @@ "text": "let fun = |x: Ptr<" }, { - "generic": "T1" + "generic": 1 }, { "text": ">, y: Ptr<" }, { - "generic": "T1" + "generic": 1 }, { "text": ">| " }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -829,7 +829,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -843,7 +843,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -897,7 +897,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -917,7 +917,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -934,7 +934,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -943,7 +943,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -983,7 +983,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1003,7 +1003,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -1020,7 +1020,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1029,7 +1029,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1069,7 +1069,7 @@ "receiver": [ { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } } @@ -1089,7 +1089,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1106,7 +1106,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1215,7 +1215,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1241,7 +1241,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1279,7 +1279,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -1313,7 +1313,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -1333,7 +1333,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -1390,7 +1390,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1404,7 +1404,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -1421,7 +1421,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -1462,7 +1462,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1476,7 +1476,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -1493,7 +1493,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -1534,7 +1534,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1543,7 +1543,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1555,7 +1555,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1575,7 +1575,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1595,7 +1595,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1629,7 +1629,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1737,7 +1737,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1757,7 +1757,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1771,7 +1771,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -1797,7 +1797,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } diff --git a/rules/algorithm/ir_unsafe.json b/rules/algorithm/ir_unsafe.json index f94c42d3..8f2d9572 100644 --- a/rules/algorithm/ir_unsafe.json +++ b/rules/algorithm/ir_unsafe.json @@ -9,7 +9,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "write" } } @@ -20,7 +20,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -41,7 +41,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -81,7 +81,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -90,7 +90,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -99,7 +99,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -108,7 +108,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -117,7 +117,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -126,7 +126,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -152,7 +152,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -256,7 +256,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -265,7 +265,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -277,7 +277,7 @@ "receiver": [ { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } } @@ -337,7 +337,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -346,7 +346,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -375,7 +375,7 @@ "receiver": [ { "placeholder": { - "arg": "a2", + "arg": 2, "access": "write" } } @@ -398,7 +398,7 @@ "receiver": [ { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } } @@ -450,7 +450,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "write" } } @@ -461,7 +461,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -482,7 +482,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -496,7 +496,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -505,7 +505,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -550,7 +550,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "write" } } @@ -561,7 +561,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -582,7 +582,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -596,7 +596,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -605,7 +605,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -647,7 +647,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -656,7 +656,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -665,7 +665,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -674,7 +674,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -709,7 +709,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -718,7 +718,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -727,7 +727,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -736,7 +736,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -774,7 +774,7 @@ "receiver": [ { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } } @@ -794,7 +794,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -811,7 +811,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -916,7 +916,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -925,7 +925,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -934,7 +934,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -993,7 +993,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "write" } } @@ -1004,7 +1004,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1025,7 +1025,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -1039,7 +1039,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -1048,7 +1048,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -1092,7 +1092,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "write" } } @@ -1103,7 +1103,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1124,7 +1124,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -1138,7 +1138,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -1147,7 +1147,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -1188,7 +1188,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1197,7 +1197,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1206,7 +1206,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1215,7 +1215,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1224,7 +1224,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1250,7 +1250,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1302,7 +1302,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -1311,7 +1311,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "write" } }, diff --git a/rules/arpa_inet/ir_unsafe.json b/rules/arpa_inet/ir_unsafe.json index f126de39..c494512a 100644 --- a/rules/arpa_inet/ir_unsafe.json +++ b/rules/arpa_inet/ir_unsafe.json @@ -6,7 +6,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -30,7 +30,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, diff --git a/rules/array/ir_refcount.json b/rules/array/ir_refcount.json index f27540af..07a75f8e 100644 --- a/rules/array/ir_refcount.json +++ b/rules/array/ir_refcount.json @@ -3,7 +3,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -26,7 +26,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } diff --git a/rules/array/ir_unsafe.json b/rules/array/ir_unsafe.json index 3727bee3..b65aefae 100644 --- a/rules/array/ir_unsafe.json +++ b/rules/array/ir_unsafe.json @@ -6,7 +6,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -39,7 +39,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -74,7 +74,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } diff --git a/rules/assert/ir_refcount.json b/rules/assert/ir_refcount.json index 92b08ee1..2deffa9f 100644 --- a/rules/assert/ir_refcount.json +++ b/rules/assert/ir_refcount.json @@ -6,7 +6,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, diff --git a/rules/assert/ir_unsafe.json b/rules/assert/ir_unsafe.json index 92b08ee1..2deffa9f 100644 --- a/rules/assert/ir_unsafe.json +++ b/rules/assert/ir_unsafe.json @@ -6,7 +6,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, diff --git a/rules/brotli/ir_refcount.json b/rules/brotli/ir_refcount.json index bd567b5c..8b49e33f 100644 --- a/rules/brotli/ir_refcount.json +++ b/rules/brotli/ir_refcount.json @@ -6,7 +6,7 @@ "receiver": [ { "placeholder": { - "arg": "a5", + "arg": 5, "access": "read" } } @@ -20,7 +20,7 @@ "receiver": [ { "placeholder": { - "arg": "a6", + "arg": 6, "access": "read" } } @@ -31,7 +31,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -40,7 +40,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -49,7 +49,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -58,7 +58,7 @@ }, { "placeholder": { - "arg": "a3", + "arg": 3, "access": "read" } }, @@ -73,7 +73,7 @@ "receiver": [ { "placeholder": { - "arg": "a4", + "arg": 4, "access": "read" } } @@ -143,7 +143,7 @@ "receiver": [ { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } } @@ -157,7 +157,7 @@ "receiver": [ { "placeholder": { - "arg": "a3", + "arg": 3, "access": "read" } } @@ -168,7 +168,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -183,7 +183,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -267,7 +267,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -304,7 +304,7 @@ "receiver": [ { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } } @@ -351,7 +351,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -376,7 +376,7 @@ "receiver": [ { "placeholder": { - "arg": "a3", + "arg": 3, "access": "read" } } @@ -387,7 +387,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -453,7 +453,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -464,7 +464,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, diff --git a/rules/brotli/ir_unsafe.json b/rules/brotli/ir_unsafe.json index 7529cd05..c43be6d9 100644 --- a/rules/brotli/ir_unsafe.json +++ b/rules/brotli/ir_unsafe.json @@ -46,7 +46,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -55,7 +55,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -64,7 +64,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -73,7 +73,7 @@ }, { "placeholder": { - "arg": "a3", + "arg": 3, "access": "read" } }, @@ -82,7 +82,7 @@ }, { "placeholder": { - "arg": "a4", + "arg": 4, "access": "read" } }, @@ -91,7 +91,7 @@ }, { "placeholder": { - "arg": "a5", + "arg": 5, "access": "read" } }, @@ -100,7 +100,7 @@ }, { "placeholder": { - "arg": "a6", + "arg": 6, "access": "read" } }, @@ -165,7 +165,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -174,7 +174,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -183,7 +183,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -192,7 +192,7 @@ }, { "placeholder": { - "arg": "a3", + "arg": 3, "access": "read" } }, @@ -239,7 +239,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -261,7 +261,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -270,7 +270,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -279,7 +279,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -288,7 +288,7 @@ }, { "placeholder": { - "arg": "a3", + "arg": 3, "access": "read" } }, @@ -333,7 +333,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -342,7 +342,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, diff --git a/rules/builtin/ir_unsafe.json b/rules/builtin/ir_unsafe.json index 39e1d96b..08934062 100644 --- a/rules/builtin/ir_unsafe.json +++ b/rules/builtin/ir_unsafe.json @@ -3,7 +3,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -27,7 +27,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -59,7 +59,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -91,7 +91,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -120,7 +120,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -149,7 +149,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } diff --git a/rules/cmath/ir_unsafe.json b/rules/cmath/ir_unsafe.json index c08c25c8..7afe7fc6 100644 --- a/rules/cmath/ir_unsafe.json +++ b/rules/cmath/ir_unsafe.json @@ -6,7 +6,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -35,7 +35,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -64,7 +64,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -93,7 +93,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -125,7 +125,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, diff --git a/rules/cstring/ir_refcount.json b/rules/cstring/ir_refcount.json index 19e6aef1..15602eb6 100644 --- a/rules/cstring/ir_refcount.json +++ b/rules/cstring/ir_refcount.json @@ -6,7 +6,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -17,7 +17,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -26,7 +26,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -44,7 +44,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -80,7 +80,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -91,7 +91,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -100,7 +100,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -118,7 +118,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -154,7 +154,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -165,7 +165,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -174,7 +174,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -207,7 +207,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -218,7 +218,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -227,7 +227,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -245,7 +245,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } diff --git a/rules/cstring/ir_unsafe.json b/rules/cstring/ir_unsafe.json index 40169981..4ddb64c0 100644 --- a/rules/cstring/ir_unsafe.json +++ b/rules/cstring/ir_unsafe.json @@ -6,7 +6,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -15,7 +15,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -24,7 +24,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -33,7 +33,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -42,7 +42,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -73,7 +73,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -82,7 +82,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -108,7 +108,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -117,7 +117,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -148,7 +148,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -157,7 +157,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -166,7 +166,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -175,7 +175,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -253,7 +253,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -262,7 +262,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -271,7 +271,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -280,7 +280,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -289,7 +289,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } diff --git a/rules/deque/ir_refcount.json b/rules/deque/ir_refcount.json index 494c8fdb..56c24837 100644 --- a/rules/deque/ir_refcount.json +++ b/rules/deque/ir_refcount.json @@ -6,7 +6,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -37,7 +37,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -63,7 +63,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -73,7 +73,7 @@ "text": ".with_mut(|__v: &mut Vec>>| " @@ -91,7 +91,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, diff --git a/rules/deque/ir_unsafe.json b/rules/deque/ir_unsafe.json index 2bb851fe..0d91b6a4 100644 --- a/rules/deque/ir_unsafe.json +++ b/rules/deque/ir_unsafe.json @@ -12,7 +12,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -65,7 +65,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -112,7 +112,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -144,7 +144,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -155,7 +155,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "move" } }, @@ -187,7 +187,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -219,7 +219,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -230,7 +230,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, diff --git a/rules/fstream/ir_refcount.json b/rules/fstream/ir_refcount.json index 9afe3a43..2cfd6156 100644 --- a/rules/fstream/ir_refcount.json +++ b/rules/fstream/ir_refcount.json @@ -12,7 +12,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -59,7 +59,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } diff --git a/rules/fstream/ir_unsafe.json b/rules/fstream/ir_unsafe.json index 7ca3e0e1..b35fa500 100644 --- a/rules/fstream/ir_unsafe.json +++ b/rules/fstream/ir_unsafe.json @@ -18,7 +18,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -73,7 +73,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -107,7 +107,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -125,7 +125,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -158,7 +158,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -213,7 +213,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -253,7 +253,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -287,7 +287,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } diff --git a/rules/initializer_list/ir_unsafe.json b/rules/initializer_list/ir_unsafe.json index 88ace81e..3103f3f0 100644 --- a/rules/initializer_list/ir_unsafe.json +++ b/rules/initializer_list/ir_unsafe.json @@ -6,7 +6,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } diff --git a/rules/iomanip/ir_unsafe.json b/rules/iomanip/ir_unsafe.json index ae5cda5d..1ed8065d 100644 --- a/rules/iomanip/ir_unsafe.json +++ b/rules/iomanip/ir_unsafe.json @@ -3,7 +3,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } diff --git a/rules/limits/ir_unsafe.json b/rules/limits/ir_unsafe.json index aeb048c5..0e41b5f9 100644 --- a/rules/limits/ir_unsafe.json +++ b/rules/limits/ir_unsafe.json @@ -5,7 +5,7 @@ "text": "<" }, { - "generic": "T1" + "generic": 1 }, { "text": ">::MAX" @@ -26,7 +26,7 @@ "text": "<" }, { - "generic": "T1" + "generic": 1 }, { "text": ">::MIN" diff --git a/rules/map/ir_refcount.json b/rules/map/ir_refcount.json index e13b80cb..799bd5ca 100644 --- a/rules/map/ir_refcount.json +++ b/rules/map/ir_refcount.json @@ -6,7 +6,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -16,13 +16,13 @@ "text": ".with_mut(|__v: &mut BTreeMap<" }, { - "generic": "T1" + "generic": 1 }, { "text": ", Value<" }, { - "generic": "T2" + "generic": 2 }, { "text": ">>| {\n " @@ -49,7 +49,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -73,7 +73,7 @@ "text": ".or_insert_with(|| Rc::new(RefCell::new(<" }, { - "generic": "T2" + "generic": 2 }, { "text": ">::default())))" @@ -128,7 +128,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -137,7 +137,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -169,7 +169,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -178,7 +178,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -210,7 +210,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -239,7 +239,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -248,7 +248,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -280,7 +280,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -318,7 +318,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -329,7 +329,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -381,7 +381,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -390,7 +390,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -422,7 +422,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -431,7 +431,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -463,7 +463,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -488,7 +488,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -524,7 +524,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -560,7 +560,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -596,7 +596,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -632,7 +632,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -668,7 +668,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -677,7 +677,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -732,7 +732,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -837,7 +837,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -848,7 +848,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -903,7 +903,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -913,13 +913,13 @@ "text": ".with_mut(|__v: &mut BTreeMap<" }, { - "generic": "T1" + "generic": 1 }, { "text": ", Value<" }, { - "generic": "T2" + "generic": 2 }, { "text": ">>| {\n " @@ -946,7 +946,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -970,7 +970,7 @@ "text": ".or_insert_with(|| Rc::new(RefCell::new(<" }, { - "generic": "T2" + "generic": 2 }, { "text": ">::default())))" @@ -1025,7 +1025,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, diff --git a/rules/map/ir_unsafe.json b/rules/map/ir_unsafe.json index 47e4dd2e..a876e246 100644 --- a/rules/map/ir_unsafe.json +++ b/rules/map/ir_unsafe.json @@ -12,7 +12,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -23,7 +23,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -78,7 +78,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -86,20 +86,20 @@ "text": " as *const BTreeMap<" }, { - "generic": "T1" + "generic": 1 }, { "text": ", Box<" }, { - "generic": "T2" + "generic": 2 }, { "text": ">>, &" }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -130,7 +130,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -139,7 +139,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -171,7 +171,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -179,13 +179,13 @@ "text": " as *const BTreeMap<" }, { - "generic": "T1" + "generic": 1 }, { "text": ", Box<" }, { - "generic": "T2" + "generic": 2 }, { "text": ">>)" @@ -211,7 +211,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -220,7 +220,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -252,7 +252,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -260,13 +260,13 @@ "text": " as *const BTreeMap<" }, { - "generic": "T1" + "generic": 1 }, { "text": ", Box<" }, { - "generic": "T2" + "generic": 2 }, { "text": ">>)" @@ -304,7 +304,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -315,7 +315,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -345,7 +345,7 @@ "text": " as *const " }, { - "generic": "T2" + "generic": 2 }, { "text": ")" @@ -374,7 +374,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -383,7 +383,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -415,7 +415,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -423,20 +423,20 @@ "text": " as *const BTreeMap<" }, { - "generic": "T1" + "generic": 1 }, { "text": ", Box<" }, { - "generic": "T2" + "generic": 2 }, { "text": ">>, &" }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -467,7 +467,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -492,7 +492,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -528,7 +528,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -565,7 +565,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -602,7 +602,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -639,7 +639,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -676,7 +676,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -684,20 +684,20 @@ "text": " as *const BTreeMap<" }, { - "generic": "T1" + "generic": 1 }, { "text": ", Box<" }, { - "generic": "T2" + "generic": 2 }, { "text": ">>, &" }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -745,7 +745,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -791,7 +791,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -802,7 +802,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -832,7 +832,7 @@ "text": " as *const " }, { - "generic": "T2" + "generic": 2 }, { "text": ")" @@ -870,7 +870,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -881,7 +881,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -936,7 +936,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -944,13 +944,13 @@ "text": " as *const BTreeMap<" }, { - "generic": "T1" + "generic": 1 }, { "text": ", Box<" }, { - "generic": "T2" + "generic": 2 }, { "text": ">>)" diff --git a/rules/math/ir_unsafe.json b/rules/math/ir_unsafe.json index e12d3db6..869aec28 100644 --- a/rules/math/ir_unsafe.json +++ b/rules/math/ir_unsafe.json @@ -6,7 +6,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -35,7 +35,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -64,7 +64,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } diff --git a/rules/pair/ir_refcount.json b/rules/pair/ir_refcount.json index cc529999..7fb7f4d6 100644 --- a/rules/pair/ir_refcount.json +++ b/rules/pair/ir_refcount.json @@ -3,7 +3,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -37,7 +37,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -68,7 +68,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -112,7 +112,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -146,7 +146,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -180,7 +180,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -237,7 +237,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -268,7 +268,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -321,7 +321,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -352,7 +352,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -405,7 +405,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -436,7 +436,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -489,7 +489,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -520,7 +520,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -573,7 +573,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -604,7 +604,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } diff --git a/rules/pair/ir_unsafe.json b/rules/pair/ir_unsafe.json index 32774953..f852a6e7 100644 --- a/rules/pair/ir_unsafe.json +++ b/rules/pair/ir_unsafe.json @@ -3,7 +3,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -34,7 +34,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -54,7 +54,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -90,7 +90,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -118,7 +118,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -158,7 +158,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -178,7 +178,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -220,7 +220,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -240,7 +240,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -282,7 +282,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -302,7 +302,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -344,7 +344,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -364,7 +364,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -406,7 +406,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -426,7 +426,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } diff --git a/rules/src/modules.rs b/rules/src/modules.rs index f3c5b168..47770137 100644 --- a/rules/src/modules.rs +++ b/rules/src/modules.rs @@ -58,8 +58,6 @@ pub mod math_tgt_unsafe; pub mod pair_tgt_refcount; #[path = r#"../pair/tgt_unsafe.rs"#] pub mod pair_tgt_unsafe; -#[path = r#"../stdarg/tgt_unsafe.rs"#] -pub mod stdarg_tgt_unsafe; #[path = r#"../stdio/tgt_refcount.rs"#] pub mod stdio_tgt_refcount; #[path = r#"../stdio/tgt_unsafe.rs"#] diff --git a/rules/stdarg/ir_unsafe.json b/rules/stdarg/ir_unsafe.json deleted file mode 100644 index afbd20c2..00000000 --- a/rules/stdarg/ir_unsafe.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "t1": { - "init": "VaList::default()", - "type": "VaList" - } -} diff --git a/rules/stdarg/src.cpp b/rules/stdarg/src.cpp deleted file mode 100644 index 9943ed0b..00000000 --- a/rules/stdarg/src.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include - -using t1 = va_list; diff --git a/rules/stdarg/tgt_unsafe.rs b/rules/stdarg/tgt_unsafe.rs deleted file mode 100644 index 94f88407..00000000 --- a/rules/stdarg/tgt_unsafe.rs +++ /dev/null @@ -1,5 +0,0 @@ -use libcc2rs::VaList; - -fn types() { - let t1: VaList = VaList::default(); -} diff --git a/rules/stdio/ir_refcount.json b/rules/stdio/ir_refcount.json index 736057e2..d3284100 100644 --- a/rules/stdio/ir_refcount.json +++ b/rules/stdio/ir_refcount.json @@ -9,7 +9,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -57,7 +57,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -149,7 +149,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -209,7 +209,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -243,7 +243,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -296,7 +296,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -308,7 +308,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -319,7 +319,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -337,7 +337,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -348,7 +348,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -366,7 +366,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -377,7 +377,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -424,7 +424,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -433,7 +433,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -442,7 +442,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -454,7 +454,7 @@ "receiver": [ { "placeholder": { - "arg": "a3", + "arg": 3, "access": "read" } } @@ -499,7 +499,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -510,7 +510,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -534,7 +534,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -582,7 +582,7 @@ "receiver": [ { "placeholder": { - "arg": "a3", + "arg": 3, "access": "read" } } @@ -711,7 +711,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -749,7 +749,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -769,7 +769,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } diff --git a/rules/stdio/ir_unsafe.json b/rules/stdio/ir_unsafe.json index 314394d0..4211c808 100644 --- a/rules/stdio/ir_unsafe.json +++ b/rules/stdio/ir_unsafe.json @@ -15,7 +15,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -80,7 +80,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -189,7 +189,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -260,7 +260,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -292,7 +292,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -334,7 +334,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -349,7 +349,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -363,7 +363,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -384,7 +384,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -398,7 +398,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -419,7 +419,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -433,7 +433,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -481,7 +481,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -490,7 +490,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -499,7 +499,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -508,7 +508,7 @@ }, { "placeholder": { - "arg": "a3", + "arg": 3, "access": "read" } }, @@ -546,7 +546,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -557,7 +557,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -572,7 +572,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -590,7 +590,7 @@ }, { "placeholder": { - "arg": "a3", + "arg": 3, "access": "read" } }, @@ -686,7 +686,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -728,7 +728,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -754,7 +754,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, diff --git a/rules/string/ir_refcount.json b/rules/string/ir_refcount.json index 8e4307f2..db87be05 100644 --- a/rules/string/ir_refcount.json +++ b/rules/string/ir_refcount.json @@ -9,7 +9,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -18,7 +18,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -27,7 +27,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -36,7 +36,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -48,7 +48,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -121,7 +121,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -164,7 +164,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -184,7 +184,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -207,7 +207,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -216,7 +216,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -237,7 +237,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -276,7 +276,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -304,7 +304,7 @@ "receiver": [ { "placeholder": { - "arg": "a3", + "arg": 3, "access": "read" } } @@ -340,7 +340,7 @@ }, { "placeholder": { - "arg": "a4", + "arg": 4, "access": "read" } }, @@ -367,7 +367,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -404,7 +404,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -444,7 +444,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -466,7 +466,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -500,7 +500,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -561,7 +561,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -609,7 +609,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -678,7 +678,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -708,7 +708,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -736,7 +736,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -775,7 +775,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -786,7 +786,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -818,7 +818,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -838,7 +838,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -855,7 +855,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -869,7 +869,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -893,7 +893,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -913,7 +913,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -949,7 +949,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -970,7 +970,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1018,7 +1018,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1048,7 +1048,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1086,7 +1086,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1134,7 +1134,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -1194,7 +1194,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1239,7 +1239,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -1275,7 +1275,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -1319,7 +1319,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1347,7 +1347,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1367,7 +1367,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1399,7 +1399,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1435,7 +1435,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, diff --git a/rules/string/ir_unsafe.json b/rules/string/ir_unsafe.json index e863d85f..8f50170b 100644 --- a/rules/string/ir_unsafe.json +++ b/rules/string/ir_unsafe.json @@ -9,7 +9,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -18,7 +18,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -27,7 +27,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -36,7 +36,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -48,7 +48,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -115,7 +115,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -200,7 +200,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -230,7 +230,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -260,7 +260,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -280,7 +280,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -291,7 +291,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -309,7 +309,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -339,7 +339,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -350,7 +350,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -359,7 +359,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -368,7 +368,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -383,7 +383,7 @@ }, { "placeholder": { - "arg": "a3", + "arg": 3, "access": "read" } }, @@ -392,7 +392,7 @@ }, { "placeholder": { - "arg": "a4", + "arg": 4, "access": "read" } }, @@ -446,7 +446,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -468,7 +468,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -510,7 +510,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -541,7 +541,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -605,7 +605,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -639,7 +639,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -744,7 +744,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -753,7 +753,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -846,7 +846,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -881,7 +881,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -913,7 +913,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -924,7 +924,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -956,7 +956,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -970,7 +970,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -990,7 +990,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1007,7 +1007,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -1016,7 +1016,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1049,7 +1049,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1091,7 +1091,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -1111,7 +1111,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -1138,7 +1138,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -1164,7 +1164,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1176,7 +1176,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1193,7 +1193,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -1202,7 +1202,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "write" } }, @@ -1236,7 +1236,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1270,7 +1270,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1378,7 +1378,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -1395,7 +1395,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1423,7 +1423,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1446,7 +1446,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1455,7 +1455,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -1517,7 +1517,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1547,7 +1547,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -1592,7 +1592,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1601,7 +1601,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1669,7 +1669,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1754,7 +1754,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1763,7 +1763,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, diff --git a/rules/unique_ptr/ir_refcount.json b/rules/unique_ptr/ir_refcount.json index 84e25123..1287c20e 100644 --- a/rules/unique_ptr/ir_refcount.json +++ b/rules/unique_ptr/ir_refcount.json @@ -15,7 +15,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -28,7 +28,7 @@ "text": ".map(|_| <" }, { - "generic": "T1" + "generic": 1 }, { "text": ">::default())" @@ -89,7 +89,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -122,7 +122,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -155,7 +155,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -188,7 +188,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -197,7 +197,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -237,7 +237,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -249,7 +249,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -282,7 +282,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -315,7 +315,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -339,7 +339,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, diff --git a/rules/unique_ptr/ir_unsafe.json b/rules/unique_ptr/ir_unsafe.json index 463724b6..e12ff0d6 100644 --- a/rules/unique_ptr/ir_unsafe.json +++ b/rules/unique_ptr/ir_unsafe.json @@ -15,7 +15,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -28,7 +28,7 @@ "text": ".map(|_| <" }, { - "generic": "T1" + "generic": 1 }, { "text": ">::default())" @@ -100,7 +100,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -118,7 +118,7 @@ "text": ".map_or(::std::ptr::null_mut(), |v| v as *mut " }, { - "generic": "T1" + "generic": 1 }, { "text": ")" @@ -147,7 +147,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -175,7 +175,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -202,14 +202,14 @@ "text": "let _a0: *mut " }, { - "generic": "T1" + "generic": 1 }, { "text": " = " }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -218,7 +218,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -263,7 +263,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -272,7 +272,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -303,7 +303,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -361,7 +361,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -385,7 +385,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, diff --git a/rules/vector/ir_refcount.json b/rules/vector/ir_refcount.json index 793f3d43..0f533932 100644 --- a/rules/vector/ir_refcount.json +++ b/rules/vector/ir_refcount.json @@ -9,7 +9,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -29,7 +29,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -39,7 +39,7 @@ "text": ".with_mut(|__v: &mut Vec<" }, { - "generic": "T1" + "generic": 1 }, { "text": ">| " @@ -75,7 +75,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -99,7 +99,7 @@ "text": " as Ptr<" }, { - "generic": "T1" + "generic": 1 }, { "text": ">" @@ -133,7 +133,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -164,7 +164,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -190,7 +190,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -227,7 +227,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -247,7 +247,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -258,7 +258,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -273,7 +273,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -311,7 +311,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -331,7 +331,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -342,7 +342,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -357,7 +357,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -389,7 +389,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -415,7 +415,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -449,7 +449,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -483,7 +483,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -494,7 +494,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -526,7 +526,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -535,7 +535,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -561,7 +561,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -570,7 +570,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -599,7 +599,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -639,7 +639,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -723,7 +723,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -736,7 +736,7 @@ "text": ".map(|_| >>::default())" @@ -775,7 +775,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -785,7 +785,7 @@ "text": ".with_mut(|__v: &mut Vec>>| " @@ -806,7 +806,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -854,7 +854,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -866,7 +866,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -876,7 +876,7 @@ "text": ".with_mut(|__v: &mut Vec>>| " @@ -893,7 +893,7 @@ "text": ".resize_with(_a0, >>::default)" @@ -935,7 +935,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -955,7 +955,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -995,7 +995,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -1032,7 +1032,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1052,7 +1052,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -1086,7 +1086,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1159,7 +1159,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1179,7 +1179,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -1213,7 +1213,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1286,7 +1286,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1306,7 +1306,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -1340,7 +1340,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1404,7 +1404,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1435,7 +1435,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1461,7 +1461,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1470,7 +1470,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1482,7 +1482,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1502,7 +1502,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1522,7 +1522,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1539,7 +1539,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1617,7 +1617,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1643,7 +1643,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1677,7 +1677,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1698,7 +1698,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1737,7 +1737,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1748,7 +1748,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1788,7 +1788,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1822,7 +1822,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1832,7 +1832,7 @@ "text": ".with_mut(|__v: &mut Vec>>| " @@ -1853,7 +1853,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -1904,7 +1904,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -1924,7 +1924,7 @@ "receiver": [ { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } } @@ -1941,7 +1941,7 @@ }, { "placeholder": { - "arg": "a3", + "arg": 3, "access": "read" } }, @@ -1953,7 +1953,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1963,7 +1963,7 @@ "text": ".with_mut(|__v: &mut Vec<" }, { - "generic": "T1" + "generic": 1 }, { "text": ">| " @@ -2010,7 +2010,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -2052,7 +2052,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -2063,7 +2063,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "move" } }, @@ -2097,7 +2097,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -2109,7 +2109,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -2155,7 +2155,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -2189,7 +2189,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -2203,7 +2203,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -2242,7 +2242,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -2268,7 +2268,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -2279,7 +2279,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -2311,7 +2311,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } diff --git a/rules/vector/ir_unsafe.json b/rules/vector/ir_unsafe.json index 3c746c6c..f3b3ed37 100644 --- a/rules/vector/ir_unsafe.json +++ b/rules/vector/ir_unsafe.json @@ -9,7 +9,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -23,7 +23,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -49,7 +49,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -66,7 +66,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -105,7 +105,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -152,7 +152,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -187,7 +187,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -199,7 +199,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -219,7 +219,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -239,7 +239,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -250,7 +250,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -283,7 +283,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -316,7 +316,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -327,7 +327,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "move" } }, @@ -359,7 +359,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -371,7 +371,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -381,7 +381,7 @@ "text": ".resize_with(__a0, || <" }, { - "generic": "T1" + "generic": 1 }, { "text": ">::default())" @@ -412,7 +412,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -444,7 +444,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -466,7 +466,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -508,7 +508,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -522,7 +522,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -548,7 +548,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -559,7 +559,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -597,7 +597,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -606,7 +606,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -639,7 +639,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -677,7 +677,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -691,7 +691,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -717,7 +717,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -728,7 +728,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -769,7 +769,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -789,7 +789,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -821,7 +821,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -844,7 +844,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -867,7 +867,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -893,7 +893,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -904,7 +904,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -936,7 +936,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -945,7 +945,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -971,7 +971,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -980,7 +980,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -1009,7 +1009,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -1043,7 +1043,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1077,7 +1077,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1115,7 +1115,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1128,7 +1128,7 @@ "text": ".map(|_| >::default())" @@ -1167,7 +1167,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -1178,7 +1178,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1208,7 +1208,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -1219,7 +1219,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1227,7 +1227,7 @@ "text": " as usize, || >::default())" @@ -1257,7 +1257,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1268,7 +1268,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1303,7 +1303,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -1340,7 +1340,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1355,7 +1355,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1369,7 +1369,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1414,7 +1414,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1441,7 +1441,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1456,7 +1456,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "write" } }, @@ -1470,7 +1470,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1524,7 +1524,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1538,7 +1538,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1585,7 +1585,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1600,7 +1600,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "write" } }, @@ -1614,7 +1614,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1689,7 +1689,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1711,7 +1711,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1750,7 +1750,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1792,7 +1792,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1807,7 +1807,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -1821,7 +1821,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -1886,7 +1886,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1922,7 +1922,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1944,7 +1944,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -1980,7 +1980,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -2001,7 +2001,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -2010,7 +2010,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "write" } }, @@ -2034,7 +2034,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -2066,7 +2066,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -2078,7 +2078,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -2104,7 +2104,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -2126,7 +2126,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -2174,7 +2174,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -2220,7 +2220,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -2234,7 +2234,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -2277,7 +2277,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -2291,7 +2291,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -2314,7 +2314,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -2323,7 +2323,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -2332,7 +2332,7 @@ }, { "placeholder": { - "arg": "a3", + "arg": 3, "access": "read" } }, @@ -2344,7 +2344,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -2401,7 +2401,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -2457,7 +2457,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } }, @@ -2469,7 +2469,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -2480,7 +2480,7 @@ }, { "placeholder": { - "arg": "a2", + "arg": 2, "access": "read" } }, @@ -2514,7 +2514,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -2523,7 +2523,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "move" } } @@ -2558,7 +2558,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -2608,7 +2608,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -2630,7 +2630,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } } @@ -2666,7 +2666,7 @@ "body": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -2678,7 +2678,7 @@ "receiver": [ { "placeholder": { - "arg": "a1", + "arg": 1, "access": "read" } } @@ -2712,7 +2712,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -2741,7 +2741,7 @@ "receiver": [ { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } } @@ -2774,7 +2774,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } }, @@ -2783,7 +2783,7 @@ }, { "placeholder": { - "arg": "a1", + "arg": 1, "access": "write" } }, @@ -2820,7 +2820,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "read" } }, @@ -2833,7 +2833,7 @@ "text": ".map(|_| <" }, { - "generic": "T1" + "generic": 1 }, { "text": ">::default())" @@ -2880,7 +2880,7 @@ }, { "placeholder": { - "arg": "a0", + "arg": 0, "access": "write" } },