From: Owen Avery Date: Sat, 22 Feb 2025 03:51:32 +0000 (-0500) Subject: Remove some member functions from SingleASTNode X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22333202dc0da0fe8dc02b1e85d52bf5cd8ca39f;p=thirdparty%2Fgcc.git Remove some member functions from SingleASTNode gcc/rust/ChangeLog: * ast/rust-ast.h (SingleASTNode::take_trait_item): Remove. (SingleASTNode::take_impl_item): Remove. (SingleASTNode::take_trait_impl_item): Remove. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Replace calls to aforementioned functions with calls to SingleASTNode::take_assoc_item. Signed-off-by: Owen Avery --- diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h index e3999dbb141..c74b1c46448 100644 --- a/gcc/rust/ast/rust-ast.h +++ b/gcc/rust/ast/rust-ast.h @@ -1996,13 +1996,6 @@ public: return std::move (item); } - std::unique_ptr take_trait_item () - { - rust_assert (!is_error ()); - return std::unique_ptr ( - static_cast (assoc_item.release ())); - } - std::unique_ptr take_external_item () { rust_assert (!is_error ()); @@ -2015,16 +2008,6 @@ public: return std::move (assoc_item); } - std::unique_ptr take_impl_item () - { - return take_assoc_item (); - } - - std::unique_ptr take_trait_impl_item () - { - return take_assoc_item (); - } - std::unique_ptr take_type () { rust_assert (!is_error ()); diff --git a/gcc/rust/expand/rust-expand-visitor.cc b/gcc/rust/expand/rust-expand-visitor.cc index b3a53c11f09..96677e34a58 100644 --- a/gcc/rust/expand/rust-expand-visitor.cc +++ b/gcc/rust/expand/rust-expand-visitor.cc @@ -865,7 +865,7 @@ ExpandVisitor::visit (AST::Trait &trait) std::function (AST::SingleASTNode)> extractor - = [] (AST::SingleASTNode node) { return node.take_trait_item (); }; + = [] (AST::SingleASTNode node) { return node.take_assoc_item (); }; expand_macro_children (MacroExpander::ContextType::TRAIT, trait.get_trait_items (), extractor); @@ -892,7 +892,8 @@ ExpandVisitor::visit (AST::InherentImpl &impl) expand_where_clause (impl.get_where_clause ()); std::function (AST::SingleASTNode)> - extractor = [] (AST::SingleASTNode node) { return node.take_impl_item (); }; + extractor + = [] (AST::SingleASTNode node) { return node.take_assoc_item (); }; expand_macro_children (MacroExpander::ContextType::IMPL, impl.get_impl_items (), extractor); @@ -920,7 +921,7 @@ ExpandVisitor::visit (AST::TraitImpl &impl) std::function (AST::SingleASTNode)> extractor - = [] (AST::SingleASTNode node) { return node.take_trait_impl_item (); }; + = [] (AST::SingleASTNode node) { return node.take_assoc_item (); }; expand_macro_children (MacroExpander::ContextType::TRAIT_IMPL, impl.get_impl_items (), extractor);