-
Notifications
You must be signed in to change notification settings - Fork 743
Integer type not generated properly when it's a template argument #75
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
Comments
Hmm... It's not that. It's a combination of two bugs. First, clang represents that as an Unexposed type. Since it has a canonical type which is an exposed one ( |
The other one is that even with that fixed, the function |
Is it possible to treat those types as opaque types and force clang to hand over them to us? |
I don't think so. I suspect the We can move the scanning of "known" typedefs over to parsing without too On Fri, Oct 07, 2016 at 05:00:43PM -0700, Xidorn Quan wrote:
|
What do you mean by "move the scanning ... over"? If we cannot hack into libclang to get the names right, we can probably do some other hacks. One idea occurs to me is to build a fake stdint.h, and make clang to use it first, and in that fake header, we define the integer types as opaque types, so that clang wouldn't replace them with the builtin types. That works for Another idea is that, we inject a normal header via #include <stdint.h>
enum __builtin_uint16_t : uint16_t;
#define uint16_t __builtin_uint16_t This would work reliably for all those types as far as it doesn't try to compile any calculation. But these hacks may break some type traits, I guess... |
Yeah, it would definitely break any integer-related traits. I guess it's probably impossible to have a solution which doesn't break any trait while makes clang report those types. |
Probably I should just make some opaque struct and teach bindgen to treat them as nsTArray in the Rust side. |
This is fixed by clang 4.0+, so the only regression pending fixing from that change is the default template parameters one (#585). Luckily that doesn't affect stylo. There's no way to get the proper parameter from libclang <4.0, so there's nothing left to be done here. |
If I have a type
nsTArray<uint16_t>
, it is expected that I would getnsTArray<u16>
from bindgen. However, I getnsTArray<::std::os::raw::c_ushort>
instead.It seems the
uint16_t
-to-u16
conversion is done intype_from_named
insidecodegen
mod. I suspect that theuint16_t
in template argument list is converted tounsigned short
in parsing phase, and consequently codegen has nothing to do with it.The text was updated successfully, but these errors were encountered: