diff options
Diffstat (limited to 'libbindgen/src')
-rw-r--r-- | libbindgen/src/ir/comp.rs | 6 | ||||
-rw-r--r-- | libbindgen/src/ir/item.rs | 11 | ||||
-rw-r--r-- | libbindgen/src/ir/ty.rs | 22 | ||||
-rw-r--r-- | libbindgen/src/parse.rs | 2 |
4 files changed, 11 insertions, 30 deletions
diff --git a/libbindgen/src/ir/comp.rs b/libbindgen/src/ir/comp.rs index d5d34262..eaccda8e 100644 --- a/libbindgen/src/ir/comp.rs +++ b/libbindgen/src/ir/comp.rs @@ -644,13 +644,7 @@ impl CompInfo { return CXChildVisit_Continue; } - let default_type = Item::from_ty(&cur.cur_type(), - Some(cur), - Some(potential_id), - ctx) - .ok(); let param = Item::named_type(cur.spelling(), - default_type, potential_id, ctx); ci.template_args.push(param); diff --git a/libbindgen/src/ir/item.rs b/libbindgen/src/ir/item.rs index 0d5e6ba2..932b06fc 100644 --- a/libbindgen/src/ir/item.rs +++ b/libbindgen/src/ir/item.rs @@ -499,8 +499,8 @@ impl Item { parent_template_args.iter().any(|parent_item| { let parent_ty = ctx.resolve_type(*parent_item); match (parent_ty.kind(), item_ty.kind()) { - (&TypeKind::Named(ref n, _), - &TypeKind::Named(ref i, _)) => n == i, + (&TypeKind::Named(ref n), + &TypeKind::Named(ref i)) => n == i, _ => false, } }) @@ -1163,7 +1163,6 @@ impl ClangItemParser for Item { ty.spelling()); Ok(Self::named_type_with_id(id, ty.spelling(), - None, relevant_parent_id, ctx)) } else { @@ -1189,7 +1188,6 @@ impl ClangItemParser for Item { /// available yet. fn named_type_with_id<S>(id: ItemId, name: S, - default: Option<ItemId>, parent_id: ItemId, ctx: &mut BindgenContext) -> ItemId @@ -1203,7 +1201,7 @@ impl ClangItemParser for Item { None, None, parent_id, - ItemKind::Type(Type::named(name, default))), + ItemKind::Type(Type::named(name))), None, None); @@ -1211,14 +1209,13 @@ impl ClangItemParser for Item { } fn named_type<S>(name: S, - default: Option<ItemId>, parent_id: ItemId, ctx: &mut BindgenContext) -> ItemId where S: Into<String>, { let id = ctx.next_item_id(); - Self::named_type_with_id(id, name, default, parent_id, ctx) + Self::named_type_with_id(id, name, parent_id, ctx) } } diff --git a/libbindgen/src/ir/ty.rs b/libbindgen/src/ir/ty.rs index 60092d54..b04afeb6 100644 --- a/libbindgen/src/ir/ty.rs +++ b/libbindgen/src/ir/ty.rs @@ -140,10 +140,10 @@ impl Type { } /// Creates a new named type, with name `name`. - pub fn named(name: String, default: Option<ItemId>) -> Self { + pub fn named(name: String) -> Self { assert!(!name.is_empty()); // TODO: stop duplicating the name, it's stupid. - let kind = TypeKind::Named(name.clone(), default); + let kind = TypeKind::Named(name.clone()); Self::new(Some(name), None, kind, false) } @@ -318,12 +318,12 @@ impl Type { ty: &Type) -> bool { let name = match *ty.kind() { - TypeKind::Named(ref name, _) => name, + TypeKind::Named(ref name) => name, ref other @ _ => unreachable!("Not a named type: {:?}", other), }; match self.kind { - TypeKind::Named(ref this_name, _) => this_name == name, + TypeKind::Named(ref this_name) => this_name == name, TypeKind::ResolvedTypeRef(t) | TypeKind::Array(t, _) | TypeKind::Pointer(t) | @@ -478,9 +478,8 @@ pub enum TypeKind { /// replace one type with another. ResolvedTypeRef(ItemId), - /// A named type, that is, a template parameter, with an optional default - /// type. - Named(String, Option<ItemId>), + /// A named type, that is, a template parameter. + Named(String), } impl Type { @@ -675,15 +674,8 @@ impl Type { return CXChildVisit_Continue; } - let default_type = - Item::from_ty(&cur.cur_type(), - Some(cur), - Some(potential_id), - ctx) - .ok(); let param = Item::named_type(cur.spelling(), - default_type, potential_id, ctx); args.push(param); @@ -903,7 +895,6 @@ impl TypeCollector for Type { TypeKind::Reference(inner) | TypeKind::Array(inner, _) | TypeKind::Alias(_, inner) | - TypeKind::Named(_, Some(inner)) | TypeKind::ResolvedTypeRef(inner) => { types.insert(inner); } @@ -919,6 +910,7 @@ impl TypeCollector for Type { TypeKind::Function(ref sig) => { sig.collect_types(context, types, item) } + TypeKind::Named(_) => {}, // FIXME: Pending types! ref other @ _ => { debug!("<Type as TypeCollector>::collect_types: Ignoring: \ diff --git a/libbindgen/src/parse.rs b/libbindgen/src/parse.rs index 28e65759..0e4164f0 100644 --- a/libbindgen/src/parse.rs +++ b/libbindgen/src/parse.rs @@ -82,7 +82,6 @@ pub trait ClangItemParser: Sized { /// Create a named template type. fn named_type<S>(name: S, - default: Option<ItemId>, parent: ItemId, context: &mut BindgenContext) -> ItemId @@ -92,7 +91,6 @@ pub trait ClangItemParser: Sized { /// `ItemId`. fn named_type_with_id<S>(id: ItemId, name: S, - default: Option<ItemId>, parent: ItemId, context: &mut BindgenContext) -> ItemId |