Skip to content

Commit

Permalink
Move default visitor templates to header
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
P-E-P authored and CohenArthur committed Nov 15, 2023
1 parent 20262da commit facd325
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
14 changes: 0 additions & 14 deletions gcc/rust/ast/rust-ast-visitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,6 @@
namespace Rust {
namespace AST {

template <typename T>
void
DefaultASTVisitor::visit (T &node)
{
node.accept_vis (*this);
}

template <typename T>
void
DefaultASTVisitor::visit (std::unique_ptr<T> &node)
{
node->accept_vis (*this);
}

void
DefaultASTVisitor::visit (AST::Crate &crate)
{
Expand Down
7 changes: 5 additions & 2 deletions gcc/rust/ast/rust-ast-visitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,12 @@ class DefaultASTVisitor : public ASTVisitor
virtual void visit (AST::FunctionParam &param) override;
virtual void visit (AST::VariadicParam &param) override;

template <typename T> void visit (T &node);
template <typename T> void visit (T &node) { node.accept_vis (*this); }

template <typename T> void visit (std::unique_ptr<T> &node);
template <typename T> void visit (std::unique_ptr<T> &node)
{
node->accept_vis (*this);
}

virtual void visit (AST::GenericArgsBinding &binding);
virtual void visit (AST::PathExprSegment &segment);
Expand Down

0 comments on commit facd325

Please sign in to comment.