From 4011a8b5a16abca411b74aa0fd131c3dc0b3771a Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Tue, 7 Nov 2023 13:02:20 +0100 Subject: gccrs: 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(-) (limited to 'gcc') diff --git a/gcc/rust/ast/rust-ast-visitor.cc b/gcc/rust/ast/rust-ast-visitor.cc index d839582..4ec5c7c 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 e5be441..43cd750 100644 --- a/gcc/rust/ast/rust-ast-visitor.h +++ b/gcc/rust/ast/rust-ast-visitor.h @@ -395,9 +395,12 @@ protected: 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); -- cgit v1.1