diff options
3 files changed, 34 insertions, 0 deletions
diff --git a/libbindgen/src/ir/item.rs b/libbindgen/src/ir/item.rs index d96936ad..b857acf9 100644 --- a/libbindgen/src/ir/item.rs +++ b/libbindgen/src/ir/item.rs @@ -142,6 +142,11 @@ impl TypeCollector for Item { ty.collect_types(ctx, types, self); } } + ItemKind::Function(ref fun) => { + if !self.is_opaque(ctx) { + types.insert(fun.signature()); + } + } _ => {} // FIXME. } } diff --git a/libbindgen/tests/expectations/tests/type-referenced-by-whitelisted-function.rs b/libbindgen/tests/expectations/tests/type-referenced-by-whitelisted-function.rs new file mode 100644 index 00000000..c9686501 --- /dev/null +++ b/libbindgen/tests/expectations/tests/type-referenced-by-whitelisted-function.rs @@ -0,0 +1,22 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +#[repr(C)] +#[derive(Debug, Copy)] +pub struct dl_phdr_info { + pub x: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_dl_phdr_info() { + assert_eq!(::std::mem::size_of::<dl_phdr_info>() , 4usize); + assert_eq!(::std::mem::align_of::<dl_phdr_info>() , 4usize); +} +impl Clone for dl_phdr_info { + fn clone(&self) -> Self { *self } +} +extern "C" { + pub fn dl_iterate_phdr(arg1: *mut dl_phdr_info) -> ::std::os::raw::c_int; +} diff --git a/libbindgen/tests/headers/type-referenced-by-whitelisted-function.h b/libbindgen/tests/headers/type-referenced-by-whitelisted-function.h new file mode 100644 index 00000000..86b00303 --- /dev/null +++ b/libbindgen/tests/headers/type-referenced-by-whitelisted-function.h @@ -0,0 +1,7 @@ +// bindgen-flags: --whitelist-function dl_iterate_phdr + +struct dl_phdr_info { + int x; +}; + +int dl_iterate_phdr(struct dl_phdr_info *); |