]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Add dump option to show node
authorBenjamin Thos <benjamin.thos@epita.fr>
Tue, 22 Oct 2024 13:06:36 +0000 (13:06 +0000)
committerArthur Cohen <arthur.cohen@embecosm.com>
Wed, 17 Dec 2025 06:20:11 +0000 (07:20 +0100)
commitb4e3c262f982dd45665ae4b6b7b564d0db5fa958
tree42a386d2aa1f85ecd41090eff8fd5a6f527db925
parent18c092b8c25e982cf47e701cec760236f31cbf2a
gccrs: Add dump option to show node

Add a new dump option to show node node as
internal comment with a blacklist to ignore some
node.

gcc/rust/ChangeLog:

* ast/rust-ast-collector.cc (TokenCollector::begin_internal_comment):
Add internal comment to print node beginning.
(TokenCollector::end_internal_comment): Add internal comment to print
node end.
(TokenCollector::visit): Add the comments of the node visited.
(TokenCollector::visit_closure_common): Likewise.
(TokenCollector::visit_loop_common): Likewise.
* ast/rust-ast-collector.h: Add internal comment as a nes Kind.
* ast/rust-ast-dump.cc (Dump::Dump): add a Dump constructor to enable
internal.
* ast/rust-ast-dump.h: Add printing of internal comment in the dump
* rust-session-manager.cc (Session::enable_dump): Activate ast dump
and fill the blacklist.
(Session::handle_internal_blacklist): Parse the flag to get node to
be blacklisted.
(Session::compile_crate): Launch ast dump internal when asked.
(Session::dump_ast_pretty_internal): Call the visitor to dump
the internals.
* rust-session-manager.h (struct CompileOptions): add Interal in
Dump option enum.

Signed-off-by: Benjamin Thos <benjamin.thos@epita.fr>
gcc/rust/ast/rust-ast-collector.cc
gcc/rust/ast/rust-ast-collector.h
gcc/rust/ast/rust-ast-dump.cc
gcc/rust/ast/rust-ast-dump.h
gcc/rust/rust-session-manager.cc
gcc/rust/rust-session-manager.h