summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Fitzgerald <fitzgen@gmail.com>2017-02-07 14:40:59 -0800
committerNick Fitzgerald <fitzgen@gmail.com>2017-02-08 10:08:36 -0800
commita69b50b01641f797d25a8caa60b036eb360550e3 (patch)
tree2275baf7815fa16ccefb2c27e5023d0321efb80b
parentabb10933a43599db506138c01285ada9f5fce114 (diff)
Rename TypeKind::TemplateRef to TypeKind::TemplateInstantiation
-rw-r--r--src/codegen/mod.rs4
-rw-r--r--src/ir/item.rs4
-rw-r--r--src/ir/ty.rs27
3 files changed, 17 insertions, 18 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index d3e204ce..0d605c14 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -521,7 +521,7 @@ impl CodeGenerator for Type {
TypeKind::Pointer(..) |
TypeKind::BlockPointer |
TypeKind::Reference(..) |
- TypeKind::TemplateRef(..) |
+ TypeKind::TemplateInstantiation(..) |
TypeKind::Function(..) |
TypeKind::ResolvedTypeRef(..) |
TypeKind::Named => {
@@ -2180,7 +2180,7 @@ impl ToRustTy for Type {
let path = item.namespace_aware_canonical_path(ctx);
aster::AstBuilder::new().ty().path().ids(path).build()
}
- TypeKind::TemplateRef(inner, ref template_args) => {
+ TypeKind::TemplateInstantiation(inner, ref template_args) => {
// PS: Sorry for the duplication here.
let mut inner_ty = inner.to_rust_ty(ctx).unwrap();
diff --git a/src/ir/item.rs b/src/ir/item.rs
index c8de95c0..f3d7a644 100644
--- a/src/ir/item.rs
+++ b/src/ir/item.rs
@@ -619,7 +619,7 @@ impl Item {
// XXX Is this completely correct? Partial template specialization
// is hard anyways, sigh...
TypeKind::TemplateAlias(_, ref args) |
- TypeKind::TemplateRef(_, ref args) => args.clone(),
+ TypeKind::TemplateInstantiation(_, ref args) => args.clone(),
// In a template specialization we've got all we want.
TypeKind::Comp(ref ci) if ci.is_template_specialization() => {
ci.template_args().iter().cloned().collect()
@@ -718,7 +718,7 @@ impl Item {
}
// Same as above.
TypeKind::ResolvedTypeRef(inner) |
- TypeKind::TemplateRef(inner, _) => {
+ TypeKind::TemplateInstantiation(inner, _) => {
item = ctx.resolve_item(inner);
}
_ => return item.id(),
diff --git a/src/ir/ty.rs b/src/ir/ty.rs
index be108cc0..a2a65623 100644
--- a/src/ir/ty.rs
+++ b/src/ir/ty.rs
@@ -217,7 +217,7 @@ impl Type {
pub fn has_vtable(&self, ctx: &BindgenContext) -> bool {
// FIXME: Can we do something about template parameters? Huh...
match self.kind {
- TypeKind::TemplateRef(t, _) |
+ TypeKind::TemplateInstantiation(t, _) |
TypeKind::TemplateAlias(t, _) |
TypeKind::Alias(t) |
TypeKind::ResolvedTypeRef(t) => ctx.resolve_type(t).has_vtable(ctx),
@@ -230,7 +230,7 @@ impl Type {
/// Returns whether this type has a destructor.
pub fn has_destructor(&self, ctx: &BindgenContext) -> bool {
match self.kind {
- TypeKind::TemplateRef(t, _) |
+ TypeKind::TemplateInstantiation(t, _) |
TypeKind::TemplateAlias(t, _) |
TypeKind::Alias(t) |
TypeKind::ResolvedTypeRef(t) => {
@@ -269,7 +269,7 @@ impl Type {
.signature_contains_named_type(ctx, ty)
}
TypeKind::TemplateAlias(_, ref template_args) |
- TypeKind::TemplateRef(_, ref template_args) => {
+ TypeKind::TemplateInstantiation(_, ref template_args) => {
template_args.iter().any(|arg| {
ctx.resolve_type(*arg)
.signature_contains_named_type(ctx, ty)
@@ -336,7 +336,7 @@ impl Type {
TypeKind::ResolvedTypeRef(inner) |
TypeKind::Alias(inner) |
TypeKind::TemplateAlias(inner, _) |
- TypeKind::TemplateRef(inner, _) => {
+ TypeKind::TemplateInstantiation(inner, _) => {
ctx.resolve_type(inner).safe_canonical_type(ctx)
}
@@ -352,7 +352,7 @@ impl Type {
TypeKind::Pointer(..) |
TypeKind::Array(..) |
TypeKind::Reference(..) |
- TypeKind::TemplateRef(..) |
+ TypeKind::TemplateInstantiation(..) |
TypeKind::ResolvedTypeRef(..) => true,
_ => false,
}
@@ -379,7 +379,7 @@ impl Type {
TypeKind::ResolvedTypeRef(inner) |
TypeKind::Alias(inner) |
TypeKind::TemplateAlias(inner, _) |
- TypeKind::TemplateRef(inner, _) => {
+ TypeKind::TemplateInstantiation(inner, _) => {
ctx.resolve_type(inner).calc_size(ctx)
}
TypeKind::Array(inner, len) => {
@@ -474,7 +474,7 @@ impl CanDeriveDefault for Type {
}
TypeKind::Void |
TypeKind::Named |
- TypeKind::TemplateRef(..) |
+ TypeKind::TemplateInstantiation(..) |
TypeKind::Reference(..) |
TypeKind::NullPtr |
TypeKind::Pointer(..) |
@@ -501,7 +501,7 @@ impl<'a> CanDeriveCopy<'a> for Type {
}
TypeKind::ResolvedTypeRef(t) |
TypeKind::TemplateAlias(t, _) |
- TypeKind::TemplateRef(t, _) |
+ TypeKind::TemplateInstantiation(t, _) |
TypeKind::Alias(t) => t.can_derive_copy(ctx, ()),
TypeKind::Comp(ref info) => {
info.can_derive_copy(ctx, (item, self.layout(ctx)))
@@ -597,10 +597,9 @@ pub enum TypeKind {
/// A reference to a type, as in: int& foo().
Reference(ItemId),
- /// A reference to a template, with different template parameter names. To
- /// see why this is needed, check out the creation of this variant in
- /// `Type::from_clang_ty`.
- TemplateRef(ItemId, Vec<ItemId>),
+ /// An instantiation of an abstract template declaration (first tuple
+ /// member) with a set of concrete template arguments (second tuple member).
+ TemplateInstantiation(ItemId, Vec<ItemId>),
/// A reference to a yet-to-resolve type. This stores the clang cursor
/// itself, and postpones its resolution.
@@ -644,7 +643,7 @@ impl Type {
TypeKind::ResolvedTypeRef(inner) |
TypeKind::Alias(inner) |
TypeKind::TemplateAlias(inner, _) |
- TypeKind::TemplateRef(inner, _) => {
+ TypeKind::TemplateInstantiation(inner, _) => {
ctx.resolve_type(inner).is_unsized(ctx)
}
TypeKind::Named |
@@ -1087,7 +1086,7 @@ impl TypeCollector for Type {
}
TypeKind::TemplateAlias(inner, ref template_args) |
- TypeKind::TemplateRef(inner, ref template_args) => {
+ TypeKind::TemplateInstantiation(inner, ref template_args) => {
types.insert(inner);
for &item in template_args {
types.insert(item);