-
Notifications
You must be signed in to change notification settings - Fork 742
Template instantiation #491
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
Conversation
c404f77
to
ced09f8
Compare
r? @emilio Ok, I think this is ready for review. Phew! |
ced09f8
to
c0897e1
Compare
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.
So nasty... But I guess r=me :)
Pass it through stylo before merging please. I can do it tomorrow if needed.
|
||
fn num_template_params(&self, _ctx: &BindgenContext) -> Option<usize> { | ||
// Wouldn't it be nice if libclang would reliably give us this | ||
// information‽ |
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.
indeed.
Oh, and thanks for all the cleanups! :) |
☔ The latest upstream changes (presumably #480) made this pull request unmergeable. Please resolve the merge conflicts. |
@emilio do you think you could try this out on stylo? I don't have a local set up. |
Thanks! |
Sure! Any chance to get it rebased? That way I'll also test all the other merged changes at the same time :) |
Working on a rebase |
This commit adds collect_children, has_children, and has_at_least_num_children methods to Cursor.
The `CanonicalTypeDeclaration` type exists as proof-by-construction that its cursor is the canonical declaration for its type. If you have a `CanonicalTypeDeclaration` instance, you know for sure that the type and cursor match up in a canonical declaration relationship, and it simply cannot be otherwise.
The TemplateDeclaration trait aggregates information about template declarations (separate from instantiations and specializations) and their template parameters into a single source of truth.
This commit create the PartialType type to represent types that we are in the middle of parsing and their cursor where we found them. Additionally, it fixes a long standing FIXME to make `currently_parsed_types` private. Finally, it implements `TemplateDeclaration` for `PartialType` so that we can get information about a partially parsed template declaration type's template parameters.
This commit renames `build_template_wrapper` to `instantiate_template` because that is what it is really doing. Additionally, it completely reworks its logic. Sometimes clang gives us rather sorry ASTs for template instantiations (particularly when they involve incomplete template declarations) and we need to manually reconstruct the template argument nesting.
c0897e1
to
41a109a
Compare
@emilio rebased! |
This is running into some issues within the |
Ok latest commit lets me generate SM bindings (which pulls in |
@bors-servo r=emilio |
📌 Commit 5b5d4f8 has been approved by |
Template instantiation I very much suspect this needs a rebase, but I haven't done it yet. This is the majority of #446, although it doesn't have the name generation for anonymous named types patches yet (that will be a different PR).
☀️ Test successful - status-travis |
I very much suspect this needs a rebase, but I haven't done it yet.
This is the majority of #446, although it doesn't have the name generation for anonymous named types patches yet (that will be a different PR).