Skip to content

Add derived set to collect derived nodes. #4047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sakupan102
Copy link
Contributor

@sakupan102 sakupan102 commented Aug 8, 2025

Instead of adding derived flag to AST node, I use a set to collect derived nodes. I distinguish between items that are automatically generated by #[derive()] and those that aren't with this set.

old PR: #4028

gcc/rust/ChangeLog:

	* expand/rust-expand-visitor.cc (builtin_derive_item): Collect derived nodes.
	(derive_item): Collect derived nodes.
	* util/rust-hir-map.cc (Mappings::add_derived_nodes): Add derived set to collect derived
	nodes.
	(Mappings::is_derived_node): Add derived set to collect derived nodes.
	* util/rust-hir-map.h: Add derived set to collect derived nodes.

Signed-off-by: Ryutaro Okada <[email protected]>
@@ -1358,5 +1358,17 @@ Mappings::lookup_captures (NodeId closure)
return cap->second;
}

void
Mappings::add_derived_nodes (NodeId node_id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be add_derived_node (not plural)

@powerboat9
Copy link
Collaborator

Otherwise, looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants