Skip to content

Commit

Permalink
Add dump option to show node
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Kamiinarii committed Dec 12, 2024
1 parent 863aad5 commit c16e81a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions gcc/rust/ast/rust-ast-collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2371,6 +2371,7 @@ TokenCollector::visit (TraitImpl &impl)
visit (impl.get_where_clause ());
});
visit_items_as_block (impl.get_impl_items ());
end_internal_comment ("TraitImpl");
}

void
Expand Down

0 comments on commit c16e81a

Please sign in to comment.