-
Notifications
You must be signed in to change notification settings - Fork 69
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
Avoid method ambiguities in TypedefMutualRef's #458
Conversation
`emit!()` for `TypedefMutualRef` will create some specializations of `Base.unsafe_convert()`, and previously they didn't declare a type for the `Ref`/`Ptr` value being passed to them, which would cause a method ambiguity with Base (detected by Aqua.jl). The problem is that the typedef will of course be declared in the C header before the struct it references, so the `Base.unsafe_convert()` specializations couldn't use the actual struct type in their signature because it won't have been created yet. This commit fixes that with the notion of a *partially emitted node* that contains *premature exprs* that haven't been emitted yet. Now `emit!()` for `TypedefMutualRef` will record the `Base.unsafe_convert()` methods as premature exprs and mark itself as a partially emitted node. Then later, `emit!()` for the `StructDefinition` will look for any partially emitted nodes that are marked for it and emit their premature expressions itself.
I'll try fixing the docs, but I have no idea what's going on with the Windows CI 👀 AFAICT it seems unrelated? |
Useful if some codebase is missing docstrings for a few definitions.
It looks like this also automatically the version of Clang 15 used.
Well, that was a bit of a rabbit hole 🙃 TL;DR:
|
Hmph, now I know why the windows tests are failing... 7zip was recently moved to a different directory, which is used by BinDeps.jl, which is used by CMake.jl, which is used by our tests: JuliaLang/julia#48931 |
CMake.jl is currently broken on 1.9 because the location of 7z.exe changed: - JuliaPackaging/CMake.jl#23 - JuliaLang/julia#48931 - JuliaInterop#458 (comment)
@@ -6937,7 +7112,7 @@ end | |||
|
|||
const CINDEX_VERSION_MAJOR = 0 | |||
|
|||
const CINDEX_VERSION_MINOR = 62 | |||
const CINDEX_VERSION_MINOR = 63 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although these low-level APIs are not exported by Clang.jl, but I think we should bump Clang.jl's minor version as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, fixed in 423820b.
src/type.jl
Outdated
@@ -70,7 +70,7 @@ getPointeeType(t::CLType)::CLType = clang_getPointeeType(t) | |||
getTypeDeclaration(t::CXType) -> CXCursor | |||
getTypeDeclaration(t::CLType) -> CLCursor | |||
Return the cursor for the declaration of the given type. To get the type of the cursor, | |||
see [`type`](@ref). Wrapper for libclang's [`clang_getTypeDeclaration`](@ref). | |||
see `typeof`. Wrapper for libclang's [`clang_getTypeDeclaration`](@ref). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see `typeof`. Wrapper for libclang's [`clang_getTypeDeclaration`](@ref). | |
see [`getCursorType`](@ref). Wrapper for libclang's [`clang_getTypeDeclaration`](@ref). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops 😅 Fixed in 49abae7.
Thanks for fixing this! I'll give it a test and update the test-suite: https://github.com/Gnimuc/GeneratorScripts |
Note that :missing_docs is now warn-only because it was complaining about everything in Clang.Generators, which we don't want/need to document. I didn't have any luck ignoring those with a `Filter` either.
This was polluting the `readdir()` results and causing the BB build to wrongly be marked as failed and fall back to the native build method with `build_libbitfield_native()`. Also added a full backtrace to the warning logs when build errors do occur in either functions.
CMake.jl is currently broken on 1.9 because the location of 7z.exe changed: - JuliaPackaging/CMake.jl#23 - JuliaLang/julia#48931 - JuliaInterop#458 (comment)
This seems to be required on Windows. Also cleaned up the whitespace.
61f1c48
to
423820b
Compare
CMake.jl is currently broken on 1.9 because the location of 7z.exe changed: - JuliaPackaging/CMake.jl#23 - JuliaLang/julia#48931 - #458 (comment)
emit!()
forTypedefMutualRef
will create some specializations ofBase.unsafe_convert()
, and previously they didn't declare a type for theRef
/Ptr
value being passed to them, which would cause a method ambiguity with Base (detected by Aqua.jl).The problem is that the typedef will of course be declared in the C header before the struct it references, so the
Base.unsafe_convert()
specializations couldn't use the actual struct type in their signature because it won't have been created yet. This commit fixes that with the notion of a partially emitted node that contains premature exprs that haven't been emitted yet. Nowemit!()
forTypedefMutualRef
will record theBase.unsafe_convert()
methods as premature exprs and mark itself as a partially emitted node. Then later,emit!()
for theStructDefinition
will look for any partially emitted nodes that are marked for it and emit their premature expressions itself.Before:
After:
I'm not sure why there's no newline after the struct definition 🤔