Skip to content
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

Report enums in ParseCallbacks. #3133

Merged
merged 1 commit into from
Feb 17, 2025
Merged

Conversation

adetaylor
Copy link
Contributor

ParseCallbacks previously reported structs but not enums. Enhance it to do so. At the moment, little information is provided about enums - but bindgen doesn't handle (rare) anonymous enums so this seems the right amount of information to report. At the moment, effectively this just provides a mapping between name and DiscoveredItemId.

One of a number of PRs I'll be raising for google/autocxx#124.

In future PRs I'll be hoping to add further callbacks which report more information based on DiscoveredItemId, so having the DiscoveredItemId for each enum is an important pre-requisite.

ParseCallbacks previously reported structs but not enums. Enhance it to do so.
At the moment, little information is provided about enums - but bindgen doesn't
handle (rare) anonymous enums so this seems the right amount of information to
report. At the moment, effectively this just provides a mapping between name
and DiscoveredItemId.

One of a number of PRs I'll be raising for google/autocxx#124.

In future PRs I'll be hoping to add further callbacks which report more
information based on DiscoveredItemId, so having the DiscoveredItemId
for each enum is an important pre-requisite.
DiscoveredItemId::new(item.id().as_usize()),
DiscoveredItem::Enum {
final_name: name.to_string(),
},
Copy link
Contributor

Choose a reason for hiding this comment

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

pre-existing but all these string allocations make me sad, maybe we should just hold an &'a str, but that's a behavior change so never mind for this patch :)

@emilio emilio added this pull request to the merge queue Feb 17, 2025
Merged via the queue into rust-lang:main with commit 5880594 Feb 17, 2025
34 checks passed
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