Skip to content

Commit fc6bd9f

Browse files
committed
Trace function signature types
This extends the `TypeCollector` trait implementation for `Item` to consider items of kind `Function` and to collect the types found in the function's signature. Fixes rust-lang#291
1 parent 77868f4 commit fc6bd9f

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

libbindgen/src/ir/item.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ impl TypeCollector for Item {
142142
ty.collect_types(ctx, types, self);
143143
}
144144
}
145+
ItemKind::Function(ref fun) => {
146+
if !self.is_opaque(ctx) {
147+
types.insert(fun.signature());
148+
}
149+
}
145150
_ => {} // FIXME.
146151
}
147152
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* automatically generated by rust-bindgen */
2+
3+
4+
#![allow(non_snake_case)]
5+
6+
7+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// bindgen-flags: --whitelist-type dl_iterate_phdr
2+
3+
struct dl_phdr_info {
4+
int x;
5+
};
6+
7+
int dl_iterate_phdr(struct dl_phdr_info *);

0 commit comments

Comments
 (0)