summaryrefslogtreecommitdiff
path: root/libbindgen/src
diff options
context:
space:
mode:
Diffstat (limited to 'libbindgen/src')
-rw-r--r--libbindgen/src/ir/comp.rs9
-rw-r--r--libbindgen/src/ir/item.rs11
-rw-r--r--libbindgen/src/ir/ty.rs22
-rw-r--r--libbindgen/src/lib.rs3
-rw-r--r--libbindgen/src/parse.rs2
5 files changed, 14 insertions, 33 deletions
diff --git a/libbindgen/src/ir/comp.rs b/libbindgen/src/ir/comp.rs
index d5d34262..1c69e618 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);
@@ -660,8 +654,7 @@ impl CompInfo {
ci.has_vtable = cur.is_virtual_base();
}
let type_id =
- Item::from_ty(&cur.cur_type(), Some(cur), None, ctx)
- .expect("BaseSpecifier");
+ Item::from_ty_or_ref(cur.cur_type(), Some(cur), None, ctx);
ci.base_members.push(type_id);
}
CXCursor_Constructor |
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/lib.rs b/libbindgen/src/lib.rs
index a74c1799..5054cd13 100644
--- a/libbindgen/src/lib.rs
+++ b/libbindgen/src/lib.rs
@@ -7,6 +7,7 @@
#![deny(missing_docs)]
#![deny(warnings)]
+#![deny(unused_extern_crates)]
// We internally use the deprecated BindgenOptions all over the place. Once we
// remove its `pub` declaration, we can un-deprecate it and remove this pragma.
@@ -17,13 +18,13 @@
#![allow(non_upper_case_globals)]
#[macro_use]
+#[allow(unused_extern_crates)]
extern crate cfg_if;
extern crate cexpr;
extern crate syntex_syntax as syntax;
extern crate aster;
extern crate quasi;
extern crate clang_sys;
-extern crate libc;
extern crate regex;
#[macro_use]
extern crate lazy_static;
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