aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-05-18 13:58:28 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:46:25 +0100
commit5c20c980f74d302a4c62590cb3da9b16d4199c37 (patch)
treea7f0f1d2ecc19afa60e2aee03b2cb95a47101cff /gcc
parentf8880772495d2e9e27c29a7874271e1f48a4bcd4 (diff)
downloadgcc-5c20c980f74d302a4c62590cb3da9b16d4199c37.zip
gcc-5c20c980f74d302a4c62590cb3da9b16d4199c37.tar.gz
gcc-5c20c980f74d302a4c62590cb3da9b16d4199c37.tar.bz2
gccrs: collector: Make visitors public
Make all trivial visitor functions public so we could easily call the collection of an ast's subtree from any node. gcc/rust/ChangeLog: * ast/rust-ast-collector.h: Make trivial visitors public. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/ast/rust-ast-collector.h34
1 files changed, 18 insertions, 16 deletions
diff --git a/gcc/rust/ast/rust-ast-collector.h b/gcc/rust/ast/rust-ast-collector.h
index ae4f9fd..91e49ca 100644
--- a/gcc/rust/ast/rust-ast-collector.h
+++ b/gcc/rust/ast/rust-ast-collector.h
@@ -42,22 +42,6 @@ private:
std::vector<TokenPtr> &tokens;
/**
- * Compatibility layer for using the visitor pattern on polymorphic classes
- * with a unified overload syntax. This allows us to call `visit` both on
- * types implementing `accept_vis` method and for classes for which the
- * `visit` method is directly implemented.
- */
- template <typename T> void visit (std::unique_ptr<T> &node)
- {
- node->accept_vis (*this);
- }
-
- /**
- * @see visit<std::unique_ptr<T>>
- */
- template <typename T> void visit (T &node);
-
- /**
* Visit all items in given @collection, placing the separator in between but
* not at the end.
*/
@@ -106,6 +90,24 @@ private:
void visit_closure_common (ClosureExpr &expr);
void visit_loop_common (BaseLoopExpr &expr);
+
+public:
+ /**
+ * Compatibility layer for using the visitor pattern on polymorphic classes
+ * with a unified overload syntax. This allows us to call `visit` both on
+ * types implementing `accept_vis` method and for classes for which the
+ * `visit` method is directly implemented.
+ */
+ template <typename T> void visit (std::unique_ptr<T> &node)
+ {
+ node->accept_vis (*this);
+ }
+
+ /**
+ * @see visit<std::unique_ptr<T>>
+ */
+ template <typename T> void visit (T &node);
+
void visit (LoopLabel &label);
void visit (Literal &lit, Location locus = {});