-
Notifications
You must be signed in to change notification settings - Fork 68
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
Forward declaration of struct defined in dependency causes duplicate code generation #489
Comments
Clang.jl/src/generator/passes.jl Lines 185 to 211 in 18f793b
It was added from the FindOpaques pass. The definition of an opaque type could be in the source file or its dependent "system" headers. I'm wondering whether there is an efficient way to check that the definition of an opaque type is in one of the system headers. |
Clang.jl/src/generator/codegen.jl Lines 700 to 718 in 18f793b
We run this pass because we want to generate strong-typed code if opaque_as_mutable_struct is on. |
A
|
I don't fully understand why this is not a bug, but I guess replacing those nodes works. |
It's a bug. I just can't come up with an elegant way to fix it... |
I have found that if the JLL I'm generating bindings for contains a forward declaration to a struct which is defined in one of its dependencies (which I include as system headers), a struct definition is still generated even though it should be skipped due to being in the system headers. Using Clang.jl v0.18.3 with
generate_isystem_symbols = false
.I'm generating bindings for aws-c-http.
This struct is forward declared here in aws-c-http.
aws-c-http includes the following file from aws-c-io.
This struct is forward declared here in aws-c-io.
This struct is defined here in aws-c-io.
For now I can work around this using
output_ignorelist
.The relevant part of my code is:
I've done some debugging and found that
aws_client_bootstrap
is not indag.sys
, so it can't be ignored bygenerate_isystem_symbols
.Also this struct is always parsed as a forward declaration:
Which is confusing because no code should be generated for those given:
So I must have missed something. That's as far as I got tonight.
The text was updated successfully, but these errors were encountered: