Replace hand-written FFI imports and C wrappers by automatically generated bindings using clang-bootstrap#39
Merged
Conversation
jorisdral
force-pushed
the
jdral/clang-bootstrap-diagnostics
branch
from
March 4, 2026 15:53
7c857f1 to
a3c5822
Compare
jorisdral
marked this pull request as ready for review
March 4, 2026 16:11
Member
Author
|
clang-bootstrap to generate FFI imports for diagnostic reportingclang-bootstrap
jorisdral
marked this pull request as draft
March 4, 2026 16:48
Member
Author
|
Though the cleanup was originally only targetting the Diagnostics Reporting section of |
jorisdral
force-pushed
the
jdral/type_getoffsetof
branch
from
March 5, 2026 12:31
5a53eff to
2c8f84d
Compare
jorisdral
force-pushed
the
jdral/clang-bootstrap-diagnostics
branch
from
March 5, 2026 12:34
a3c5822 to
491b3cb
Compare
jorisdral
force-pushed
the
jdral/clang-bootstrap-diagnostics
branch
from
March 5, 2026 16:20
491b3cb to
8685a35
Compare
We will be replacing these hand-written foreign imports by automatically generated ones in the `FFI` module. But first we move the hand-written foreign imports to the `FFI` module so that we get a nice diff that we can inspect for any discrepancies between the hand-written foreign imports and the (future) automatically generated foreign imports.
For a nicer diff, we make sure that the foreign imports in the `FFI` module are sorted according to the order in which we will automatically generate foreign imports in the future. The sort order is picked to match the `libclang`/`clang-c` documentation: https://clang.llvm.org/doxygen/topics.html
Again, this is done to improve the diff between the manually written foreign imports we have now and the automatically generated ones that will replace them.
Not strictly necessary, but useful nonetheless.
jorisdral
force-pushed
the
jdral/clang-bootstrap-diagnostics
branch
2 times, most recently
from
March 9, 2026 09:56
95064eb to
d6683c5
Compare
jorisdral
commented
Mar 9, 2026
edsko
approved these changes
Mar 10, 2026
…rated bindings using `clang-bootstrap Notable differences in the `foreign imports` * Use `ConstPtr` rather than `Ptr` for pointer-to-const-qualified-contents * Use `CUInt` rather than `BitfieldEnum CXDiagnosticDisplayOptions` for `unsigned Options`. The `BitfieldEnum` is still used, but at a higher level than the raw `foreign import`s. * `foreign import`s that now use `capi` rather than `ccall`: - `nowrapper_parseTranslationUnit` - `nowrapper_parseTranslationUnit2` * `foreign import`s that now use `unsafe` rather than `safe`: - `wrap_Location_isFromMainFile` - `nowrapper_disposeTranslationUnit` - `nowrapper_getTranslationUnitTargetInfo` - `nowrapper_TargetInfo_dispose` - `wrap_TargetInfo_getTriple`
jorisdral
force-pushed
the
jdral/clang-bootstrap-diagnostics
branch
from
March 11, 2026 09:19
a731705 to
26048b6
Compare
jorisdral
marked this pull request as ready for review
March 11, 2026 09:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #40