-
Notifications
You must be signed in to change notification settings - Fork 747
Codegen errors creduced from stylo #638
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
More reduced, and with names to make things make sense: // bindgen-flags: -- -std=c++14
template <class T>
class RefPtr {
T use_of_t;
};
template <typename U>
class UsesRefPtrWithAliasedTypeParam {
typedef U TypedefU;
RefPtr<TypedefU> member;
}; |
Emitted bindings: /* automatically generated by rust-bindgen */
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RefPtr<T> {
pub use_of_t: T,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct UsesRefPtrWithAliasedTypeParam {
pub member: RefPtr<UsesRefPtrWithAliasedTypeParam_TypedefU<U>>,
}
pub type UsesRefPtrWithAliasedTypeParam_TypedefU<U> = U; IR graph: We're failing to emit a type alias for the typedef, but it looks like we have everything we need in the IR... Not 100% sure what's up. |
Ahhhh I think this is a bug in how we reconstruct template instantiations when clang won't give us the info we need. |
Wait, wrong again. We have the correct IR, but we end up generating a generic instantiation from the alias instead of just using it... pub member: RefPtr<UsesRefPtrWithAliasedTypeParam_TypedefU<U>>, Instead of pub member: RefPtr<UsesRefPtrWithAliasedTypeParam_TypedefU>, And generating the appropriate type alias. |
Ok, I have a fix incoming. |
In stylo bindings generation, we were hitting bugs where the analysis saw a template type parameter behind a type ref to a type alias, and this was then used as an argument to a template instantiation. Because of the indirection, the analysis got confused and ignored the template argument because it was "not" a named template type, and therefore we didn't care about its usage. This commit makes sure that we keep resolving through type references and aliases to find the inner named template type parameter to add to the current item's usage set. Fixes rust-lang#638.
In stylo bindings generation, we were hitting bugs where the analysis saw a template type parameter behind a type ref to a type alias, and this was then used as an argument to a template instantiation. Because of the indirection, the analysis got confused and ignored the template argument because it was "not" a named template type, and therefore we didn't care about its usage. This commit makes sure that we keep resolving through type references and aliases to find the inner named template type parameter to add to the current item's usage set. Fixes rust-lang#638.
Input C/C++ Header
Bindgen Invokation
Something like:
Actual Results
Which then results in compilation errors:
cc @emilio
The text was updated successfully, but these errors were encountered: