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

Use Clang's -fmodules #678

Merged
merged 1 commit into from
Dec 12, 2024
Merged

Use Clang's -fmodules #678

merged 1 commit into from
Dec 12, 2024

Conversation

madsmtm
Copy link
Owner

@madsmtm madsmtm commented Dec 12, 2024

Clang has something called "modules", which are a mechanism to describe and combine a set of headers into a single cohesive unit. This is what Swift uses when mapping frameworks, so it makes sense for us to do the same. Objective-C also recently gained the @import syntax to do the same.

I've been wanting to use this for a while, but I couldn't figure out the right set of flags to use to get Clang - that is, until today! The secret sauce was a combination of passing the .modulemap as the root file, and using the -Xclang -emit-module flags.

This should unblock #640, makes it easier to use API notes in the future, makes the separation between frameworks/modules cleaner (might even be able to do make the header translator multi-threaded in the future?), and is generally more correct.

@madsmtm madsmtm added enhancement New feature or request A-framework Affects the framework crates and the translator for them labels Dec 12, 2024
Clang has something called "modules", which are a mechanism to describe
and combine a set of headers into a single cohesive unit:
https://clang.llvm.org/docs/Modules.html

This is what Swift uses when mapping frameworks, so it makes sense for
us to do the same. Objective-C also recently gained the `@import` syntax
to do the same.

This should unblock our support for umbrella frameworks, makes it easier
to use API notes in the future, and is generally more correct.
@madsmtm madsmtm merged commit 4020e7c into master Dec 12, 2024
20 checks passed
@madsmtm madsmtm deleted the fmodules branch December 12, 2024 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-framework Affects the framework crates and the translator for them enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant