diff options
author | Nick Fitzgerald <fitzgen@gmail.com> | 2017-01-26 16:17:48 -0800 |
---|---|---|
committer | Nick Fitzgerald <fitzgen@gmail.com> | 2017-01-26 16:17:48 -0800 |
commit | dd3eb89fa19545c43f4332182e4206c19ec78455 (patch) | |
tree | 90cd9c3f163d28384fb779c45cf4969d1ebb0b9a | |
parent | 41135ca8ee579a7481fdb52724cc774b8552d1e7 (diff) |
Trace constructors in CompInfo's TypeCollector impl
Fixes #447
-rw-r--r-- | src/ir/comp.rs | 4 | ||||
-rw-r--r-- | tests/expectations/tests/issue-447.rs | 63 | ||||
-rw-r--r-- | tests/headers/issue-447.hpp | 27 |
3 files changed, 94 insertions, 0 deletions
diff --git a/src/ir/comp.rs b/src/ir/comp.rs index 4eea1d7a..bad661da 100644 --- a/src/ir/comp.rs +++ b/src/ir/comp.rs @@ -978,5 +978,9 @@ impl TypeCollector for CompInfo { for method in self.methods() { types.insert(method.signature); } + + for &ctor in self.constructors() { + types.insert(ctor); + } } } diff --git a/tests/expectations/tests/issue-447.rs b/tests/expectations/tests/issue-447.rs new file mode 100644 index 00000000..b49caa54 --- /dev/null +++ b/tests/expectations/tests/issue-447.rs @@ -0,0 +1,63 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +pub mod root { + #[allow(unused_imports)] + use self::super::root; + pub mod mozilla { + #[allow(unused_imports)] + use self::super::super::root; + pub mod detail { + #[allow(unused_imports)] + use self::super::super::super::root; + #[repr(C)] + #[derive(Debug, Copy)] + pub struct GuardObjectNotifier { + pub _address: u8, + } + #[test] + fn bindgen_test_layout_GuardObjectNotifier() { + assert_eq!(::std::mem::size_of::<GuardObjectNotifier>() , + 1usize); + assert_eq!(::std::mem::align_of::<GuardObjectNotifier>() , + 1usize); + } + impl Clone for GuardObjectNotifier { + fn clone(&self) -> Self { *self } + } + } + } + #[repr(C)] + #[derive(Debug, Copy)] + pub struct JSAutoCompartment { + pub _address: u8, + } + #[test] + fn bindgen_test_layout_JSAutoCompartment() { + assert_eq!(::std::mem::size_of::<JSAutoCompartment>() , 1usize); + assert_eq!(::std::mem::align_of::<JSAutoCompartment>() , 1usize); + } + extern "C" { + #[link_name = + "_ZN17JSAutoCompartmentC1EN7mozilla6detail19GuardObjectNotifierE"] + pub fn JSAutoCompartment_JSAutoCompartment(this: + *mut root::JSAutoCompartment, + arg1: + root::mozilla::detail::GuardObjectNotifier); + } + impl Clone for JSAutoCompartment { + fn clone(&self) -> Self { *self } + } + impl JSAutoCompartment { + #[inline] + pub unsafe fn new(arg1: root::mozilla::detail::GuardObjectNotifier) + -> Self { + let mut __bindgen_tmp = ::std::mem::uninitialized(); + JSAutoCompartment_JSAutoCompartment(&mut __bindgen_tmp, arg1); + __bindgen_tmp + } + } +} diff --git a/tests/headers/issue-447.hpp b/tests/headers/issue-447.hpp new file mode 100644 index 00000000..017838c4 --- /dev/null +++ b/tests/headers/issue-447.hpp @@ -0,0 +1,27 @@ +// bindgen-flags: --enable-cxx-namespaces --whitelist-type JSAutoCompartment -- -std=c++11 + +namespace mozilla { + template <typename> class a {}; + namespace detail { + class GuardObjectNotifier {}; + struct b; + } + class c { + typedef detail::b d; + }; +} +namespace js { + class D { + mozilla::a<mozilla::c> e; + }; +} +struct f { + js::D g; +}; +namespace js { + struct ContextFriendFields : f {}; +} +class JSAutoCompartment { +public: + JSAutoCompartment(mozilla::detail::GuardObjectNotifier); +}; |