]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Move default visitor templates to header
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Tue, 7 Nov 2023 12:02:20 +0000 (13:02 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:13:14 +0000 (19:13 +0100)
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 <pierre-emmanuel.patry@embecosm.com>
gcc/rust/ast/rust-ast-visitor.cc
gcc/rust/ast/rust-ast-visitor.h

index d8395820892e432f6a6c01aaba14ec88cac09b26..4ec5c7cf1d0a77beed2bc3cf4fc925d6741f1119 100644 (file)
 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)
 {
index e5be44157ed63bc9379dfada951892b424fc2d85..43cd750f5f7e06fdf3e8421ff58e868f1718fafd 100644 (file)
@@ -395,9 +395,12 @@ protected:
   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);