diff options
author | Marc Poulhiès <dkm@kataplop.net> | 2023-04-06 19:20:55 +0200 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2023-04-11 07:42:45 +0000 |
commit | 62d48d5e4a9e10aa31509dcdd3e6d960c40f4134 (patch) | |
tree | 904408b4e3dc158a4f9330e7673cd9fd951f6723 /gcc/rust/resolve/rust-ast-resolve-expr.cc | |
parent | 2bc9f60374ff5a5910d5a3d746d20903a8f50543 (diff) | |
download | gcc-62d48d5e4a9e10aa31509dcdd3e6d960c40f4134.zip gcc-62d48d5e4a9e10aa31509dcdd3e6d960c40f4134.tar.gz gcc-62d48d5e4a9e10aa31509dcdd3e6d960c40f4134.tar.bz2 |
gccrs: Introduce AST::Visitable class for AST
AST::Visitable is an abstract class with a unique accept_vis() method.
Make all abstract AST node class inherit from this class.
Allows for easy definition of operations on nodes that must accept a
visitor.
The static Dump::dump() is an example of such use: the static method
accepts any AST node, creates a Dump visitor and have it visit the AST
starting at the node.
This change also inserts a debug(Visitable&) function in the global
namespace to make it easy to call from the debugger (similar to
debug_tree or debug(rtx*) functions).
gcc/rust/ChangeLog:
* ast/rust-ast-dump.cc (Dump::debug): New.
* ast/rust-ast-dump.h (Dump::debug): Untemplate it.
(debug): New.
* ast/rust-ast.h (class Visitable): New.
(class TokenTree): Inherit from Visitable.
(class MacroMatch): Likewise.
(class AttrInput): Likewise.
(class MetaItemInner): Likewise.
(class Pattern): Likewise.
(classTypeParamBound): Likewise.
(class GenericParam): Likewise.
(class TraitItem): Likewise.
(classInherentImplItem): Likewise.
(class TraitImplItem): Likewise.
(class ExternalItem): Likewise.
(class SingleASTNode): Likewise.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
Diffstat (limited to 'gcc/rust/resolve/rust-ast-resolve-expr.cc')
0 files changed, 0 insertions, 0 deletions