Skip to content

Options to generate uncallable C++ functions. #3139

New issue

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

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

Already on GitHub? # to your account

Merged
merged 3 commits into from
Apr 4, 2025

Conversation

adetaylor
Copy link
Contributor

Downstream code generators may need to know about the existence of certain C++ functions even if those functions can't be called. This is counterintuitive but:

  • A type can't even be allocated if it contains pure virtual functions or if its constructor is private.
  • A type may not be relocatable if it contains a deleted move constructor.

This PR provides command line options to reveal the existence of these functions. Subsequent PRs will announce their special status using the ParseCallbacks mechanism.

Part of google/autocxx#124.

Downstream code generators may need to know about the existence of certain C++
functions even if those functions can't be called. This is counterintuitive but:

* A type can't even be allocated if it contains pure virtual functions
  or if its constructor is private.
* A type may not be relocatable if it contains a deleted move constructor.

This PR provides command line options to reveal the existence of these
functions. Subsequent PRs will announce their special status using the
ParseCallbacks mechanism.

Part of google/autocxx#124.
@adetaylor adetaylor mentioned this pull request Feb 19, 2025
8 tasks
@emilio
Copy link
Contributor

emilio commented Feb 19, 2025

Clippy seems unhappy and so on, but this seems fine.

@adetaylor adetaylor marked this pull request as ready for review February 19, 2025 16:01
adetaylor added a commit to adetaylor/rust-bindgen that referenced this pull request Feb 21, 2025
This change reports extra C++ information about items:

* Whether methods are virtual or pure virtual or neither
* Whether a method is a "special member", e.g. a move constructor
* Whether a method is defaulted or deleted
* C++ visibility (for structs, enums, unions and methods)

It builds on top of rust-lang#3145.

This PR is not yet ready for merge, since we need to merge rust-lang#3139
and then enhance the tests to cover those cases too.

Part of google/autocxx#124
adetaylor added a commit to adetaylor/rust-bindgen that referenced this pull request Feb 21, 2025
This change reports extra C++ information about items:

* Whether methods are virtual or pure virtual or neither
* Whether a method is a "special member", e.g. a move constructor
* Whether a method is defaulted or deleted
* C++ visibility (for structs, enums, unions and methods)

It builds on top of rust-lang#3145.

A follow up PR should enhance the tests once rust-lang#3139 is merged.

Part of google/autocxx#124
@emilio emilio added this pull request to the merge queue Apr 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 4, 2025
@emilio emilio added this pull request to the merge queue Apr 4, 2025
Merged via the queue into rust-lang:main with commit 0f2c9f2 Apr 4, 2025
34 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants