From facd325f9efdfec09773bb878bec5c673952a479 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Tue, 7 Nov 2023 13:02:20 +0100 Subject: [PATCH] Move default visitor templates to header Move default ast visitor template implementation to headers in order to match the codebase and avoid link errors. gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Move from here... * ast/rust-ast-visitor.h: ... to here. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/ast/rust-ast-visitor.cc | 14 -------------- gcc/rust/ast/rust-ast-visitor.h | 7 +++++-- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/gcc/rust/ast/rust-ast-visitor.cc b/gcc/rust/ast/rust-ast-visitor.cc index d8395820892e..4ec5c7cf1d0a 100644 --- a/gcc/rust/ast/rust-ast-visitor.cc +++ b/gcc/rust/ast/rust-ast-visitor.cc @@ -30,20 +30,6 @@ namespace Rust { namespace AST { -template -void -DefaultASTVisitor::visit (T &node) -{ - node.accept_vis (*this); -} - -template -void -DefaultASTVisitor::visit (std::unique_ptr &node) -{ - node->accept_vis (*this); -} - void DefaultASTVisitor::visit (AST::Crate &crate) { diff --git a/gcc/rust/ast/rust-ast-visitor.h b/gcc/rust/ast/rust-ast-visitor.h index 00886f616e30..8ea118bc3fa2 100644 --- a/gcc/rust/ast/rust-ast-visitor.h +++ b/gcc/rust/ast/rust-ast-visitor.h @@ -395,9 +395,12 @@ class DefaultASTVisitor : public ASTVisitor virtual void visit (AST::FunctionParam ¶m) override; virtual void visit (AST::VariadicParam ¶m) override; - template void visit (T &node); + template void visit (T &node) { node.accept_vis (*this); } - template void visit (std::unique_ptr &node); + template void visit (std::unique_ptr &node) + { + node->accept_vis (*this); + } virtual void visit (AST::GenericArgsBinding &binding); virtual void visit (AST::PathExprSegment &segment);