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

Provide option to get real virtual fn receiver. #3138

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

adetaylor
Copy link
Contributor

For virtual functions, bindgen has traditionally emitted a void* pointer because that's the least bad option for Rust code directly consuming the bindings. For downstream postprocessors and code generators, this throws away useful information about the actual type of the receiver. Provide a command-line option to put that back.

Part of google/autocxx#124

@adetaylor adetaylor mentioned this pull request Feb 19, 2025
8 tasks
@adetaylor adetaylor marked this pull request as ready for review February 19, 2025 15:10
if !is_static &&
(!is_virtual ||
ctx.options().use_specific_virtual_function_receiver)
{
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this might be worth making the default behavior fwiw. This goes back to cfdf15f. But yeah making it opt-in makes sense to me.

@emilio emilio added this pull request to the merge queue Feb 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Feb 19, 2025
@emilio
Copy link
Contributor

emilio commented Feb 20, 2025

@adetaylor this needs a rebase I think.

For virtual functions, bindgen has traditionally emitted a void* pointer
because that's the least bad option for Rust code directly consuming the
bindings. For downstream postprocessors and code generators, this throws away
useful information about the actual type of the receiver. Provide a
command-line option to put that back.

Part of google/autocxx#124
@emilio emilio added this pull request to the merge queue Feb 20, 2025
Merged via the queue into rust-lang:main with commit 20aa65a Feb 20, 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