From db5fe4af174e459e9186bddf733083fe04c96a4e Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Mon, 12 Dec 2016 09:15:29 -0500 Subject: [PATCH 1/2] WIP(emilio) - recursively whitelist argument types --- libbindgen/src/ir/comp.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libbindgen/src/ir/comp.rs b/libbindgen/src/ir/comp.rs index d5d3426245..282fc28f42 100644 --- a/libbindgen/src/ir/comp.rs +++ b/libbindgen/src/ir/comp.rs @@ -869,14 +869,14 @@ impl TypeCollector for CompInfo { type Extra = Item; fn collect_types(&self, - context: &BindgenContext, + ctx: &BindgenContext, types: &mut ItemSet, item: &Item) { if let Some(template) = self.specialized_template() { types.insert(template); } - let applicable_template_args = item.applicable_template_args(context); + let applicable_template_args = item.applicable_template_args(ctx); for arg in applicable_template_args { types.insert(arg); } @@ -893,6 +893,11 @@ impl TypeCollector for CompInfo { types.insert(ty); } - // FIXME(emilio): Methods, VTable? + // FIXME(emilio): Fix builds before running this by default. + if ctx.options().codegen_config.methods { + for method in self.methods() { + types.insert(method.signature); + } + } } } From 936517ca7f5709a6749f9e7559f5414a362c742e Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Thu, 22 Dec 2016 23:33:30 -0500 Subject: [PATCH 2/2] don't skip inlined functions, and avoid an assert that msvc hits --- libbindgen/src/ir/comp.rs | 6 +++--- libbindgen/src/ir/ty.rs | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libbindgen/src/ir/comp.rs b/libbindgen/src/ir/comp.rs index 282fc28f42..211f9f58ea 100644 --- a/libbindgen/src/ir/comp.rs +++ b/libbindgen/src/ir/comp.rs @@ -688,9 +688,9 @@ impl CompInfo { return CXChildVisit_Continue; } - if cur.is_inlined_function() { - return CXChildVisit_Continue; - } + //if cur.is_inlined_function() { + // return CXChildVisit_Continue; + //} let spelling = cur.spelling(); if spelling.starts_with("operator") { diff --git a/libbindgen/src/ir/ty.rs b/libbindgen/src/ir/ty.rs index 1878471dc2..551c1e37ae 100644 --- a/libbindgen/src/ir/ty.rs +++ b/libbindgen/src/ir/ty.rs @@ -785,7 +785,13 @@ impl Type { } CXType_Auto => { // We don't want to blow the stack. - assert!(canonical_ty != *ty, "Couldn't find deduced type"); + // MSVC builds hit this in the builtin definitions + if canonical_ty == *ty && ty.declaration().kind() == CXCursor_NoDeclFound { + warn!("Couldn't find deduced type for {:?}", ty); + return Err(ParseError::Continue); + } else { + assert!(canonical_ty != *ty, "Couldn't find deduced type"); + } return Self::from_clang_ty(potential_id, &canonical_ty, location,