From: Philip Herron Date: Wed, 15 Mar 2023 16:50:03 +0000 (+0000) Subject: gccrs: remove proxy class to use virtual method to get impl_item name X-Git-Tag: basepoints/gcc-15~2765 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dc92981d06a8695bf589a1fcfda427a38265ebee;p=thirdparty%2Fgcc.git gccrs: remove proxy class to use virtual method to get impl_item name gcc/rust/ChangeLog: * typecheck/rust-hir-inherent-impl-overlap.h (class ImplItemToName): remove Signed-off-by: Philip Herron --- diff --git a/gcc/rust/typecheck/rust-hir-inherent-impl-overlap.h b/gcc/rust/typecheck/rust-hir-inherent-impl-overlap.h index c6db896bb4fe..6ab5dc020077 100644 --- a/gcc/rust/typecheck/rust-hir-inherent-impl-overlap.h +++ b/gcc/rust/typecheck/rust-hir-inherent-impl-overlap.h @@ -25,43 +25,6 @@ namespace Rust { namespace Resolver { -class ImplItemToName : private TypeCheckBase, private HIR::HIRImplVisitor -{ -public: - static bool resolve (HIR::ImplItem *item, std::string &name_result) - { - ImplItemToName resolver (name_result); - item->accept_vis (resolver); - return resolver.ok; - } - - void visit (HIR::TypeAlias &alias) override - { - ok = true; - result.assign (alias.get_new_type_name ()); - } - - void visit (HIR::Function &function) override - { - ok = true; - result.assign (function.get_function_name ()); - } - - void visit (HIR::ConstantItem &constant) override - { - ok = true; - result.assign (constant.get_identifier ()); - } - -private: - ImplItemToName (std::string &result) - : TypeCheckBase (), ok (false), result (result) - {} - - bool ok; - std::string &result; -}; - class OverlappingImplItemPass : public TypeCheckBase { public: @@ -97,10 +60,7 @@ public: if (!ok) return; - std::string impl_item_name; - ok = ImplItemToName::resolve (impl_item, impl_item_name); - rust_assert (ok); - + std::string impl_item_name = impl_item->get_impl_item_name (); std::pair elem (impl_item, impl_item_name); impl_mappings[impl_type].insert (std::move (elem)); }