Auto merge of #860 - emilio:issue-848, r=fitzgen

lib: Filter out include paths when looking for clang paths.

Fixes #848
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 05e16a5..4ae0bfe 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -1414,7 +1414,7 @@
 
         let is_union = self.kind() == CompKind::Union;
         let mut derives = vec![];
-        if item.can_derive_debug(ctx, ()) {
+        if item.can_derive_debug(ctx) {
             derives.push("Debug");
         }
 
diff --git a/src/ir/analysis/has_vtable.rs b/src/ir/analysis/has_vtable.rs
index 47c9ee1..a157307 100644
--- a/src/ir/analysis/has_vtable.rs
+++ b/src/ir/analysis/has_vtable.rs
@@ -157,12 +157,6 @@
 /// looking up the results of the HasVtableAnalysis's computations for a
 /// specific thing.
 pub trait HasVtable {
-
-    /// Implementations can define this type to get access to any extra
-    /// information required to determine whether they have vtable. If
-    /// extra information is unneeded, then this should simply be the unit type.
-    type Extra;
-
     /// Return `true` if this thing has vtable, `false` otherwise.
-    fn has_vtable(&self, ctx: &BindgenContext, extra: &Self::Extra) -> bool;
+    fn has_vtable(&self, ctx: &BindgenContext) -> bool;
 }
diff --git a/src/ir/context.rs b/src/ir/context.rs
index 3232e8e..6c38e8e 100644
--- a/src/ir/context.rs
+++ b/src/ir/context.rs
@@ -40,10 +40,8 @@
 }
 
 impl CanDeriveDebug for ItemId {
-    type Extra = ();
-
-    fn can_derive_debug(&self, ctx: &BindgenContext, _: ()) -> bool {
-        ctx.resolve_item(*self).can_derive_debug(ctx, ())
+    fn can_derive_debug(&self, ctx: &BindgenContext) -> bool {
+        ctx.options().derive_debug && ctx.lookup_item_id_can_derive_debug(*self)
     }
 }
 
diff --git a/src/ir/derive.rs b/src/ir/derive.rs
index 446d243..3334618 100644
--- a/src/ir/derive.rs
+++ b/src/ir/derive.rs
@@ -10,17 +10,9 @@
 /// derive debug or not, because of the limit rust has on 32 items as max in the
 /// array.
 pub trait CanDeriveDebug {
-    /// Implementations can define this type to get access to any extra
-    /// information required to determine whether they can derive `Debug`. If
-    /// extra information is unneeded, then this should simply be the unit type.
-    type Extra;
-
     /// Return `true` if `Debug` can be derived for this thing, `false`
     /// otherwise.
-    fn can_derive_debug(&self,
-                        ctx: &BindgenContext,
-                        extra: Self::Extra)
-                        -> bool;
+    fn can_derive_debug(&self, ctx: &BindgenContext) -> bool;
 }
 
 /// A trait that encapsulates the logic for whether or not we can derive `Debug`.
diff --git a/src/ir/item.rs b/src/ir/item.rs
index b3a26bb..92954a8 100644
--- a/src/ir/item.rs
+++ b/src/ir/item.rs
@@ -271,9 +271,7 @@
 }
 
 impl CanDeriveDebug for Item {
-    type Extra = ();
-
-    fn can_derive_debug(&self, ctx: &BindgenContext, _: ()) -> bool {
+    fn can_derive_debug(&self, ctx: &BindgenContext) -> bool {
         ctx.options().derive_debug && ctx.lookup_item_id_can_derive_debug(self.id())
     }
 }
@@ -949,17 +947,13 @@
 }
 
 impl HasVtable for ItemId {
-    type Extra = ();
-
-    fn has_vtable(&self, ctx: &BindgenContext, _: &()) -> bool {
+    fn has_vtable(&self, ctx: &BindgenContext) -> bool {
         ctx.lookup_item_id_has_vtable(self)
     }
 }
 
 impl HasVtable for Item {
-    type Extra = ();
-
-    fn has_vtable(&self, ctx: &BindgenContext, _: &()) -> bool {
+    fn has_vtable(&self, ctx: &BindgenContext) -> bool {
         ctx.lookup_item_id_has_vtable(&self.id())
     }
 }
diff --git a/src/ir/ty.rs b/src/ir/ty.rs
index b189cea..1c21356 100644
--- a/src/ir/ty.rs
+++ b/src/ir/ty.rs
@@ -2,7 +2,7 @@
 
 use super::comp::CompInfo;
 use super::context::{BindgenContext, ItemId};
-use super::derive::{CanDeriveCopy, CanDeriveDebug, CanDeriveDefault};
+use super::derive::{CanDeriveCopy, CanDeriveDefault};
 use super::dot::DotAttributes;
 use super::enum_ty::Enum;
 use super::function::FunctionSig;
@@ -526,14 +526,6 @@
     }
 }
 
-impl CanDeriveDebug for Type {
-    type Extra = Item;
-
-    fn can_derive_debug(&self, ctx: &BindgenContext, item: Item) -> bool {
-        ctx.lookup_item_id_can_derive_debug(item.id())
-    }
-}
-
 impl<'a> CanDeriveDefault<'a> for Type {
     type Extra = &'a Item;