Skip to content

Commit dd3eb89

Browse files
committed
Trace constructors in CompInfo's TypeCollector impl
Fixes #447
1 parent 41135ca commit dd3eb89

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed

src/ir/comp.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,5 +978,9 @@ impl TypeCollector for CompInfo {
978978
for method in self.methods() {
979979
types.insert(method.signature);
980980
}
981+
982+
for &ctor in self.constructors() {
983+
types.insert(ctor);
984+
}
981985
}
982986
}

tests/expectations/tests/issue-447.rs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/* automatically generated by rust-bindgen */
2+
3+
4+
#![allow(non_snake_case)]
5+
6+
7+
pub mod root {
8+
#[allow(unused_imports)]
9+
use self::super::root;
10+
pub mod mozilla {
11+
#[allow(unused_imports)]
12+
use self::super::super::root;
13+
pub mod detail {
14+
#[allow(unused_imports)]
15+
use self::super::super::super::root;
16+
#[repr(C)]
17+
#[derive(Debug, Copy)]
18+
pub struct GuardObjectNotifier {
19+
pub _address: u8,
20+
}
21+
#[test]
22+
fn bindgen_test_layout_GuardObjectNotifier() {
23+
assert_eq!(::std::mem::size_of::<GuardObjectNotifier>() ,
24+
1usize);
25+
assert_eq!(::std::mem::align_of::<GuardObjectNotifier>() ,
26+
1usize);
27+
}
28+
impl Clone for GuardObjectNotifier {
29+
fn clone(&self) -> Self { *self }
30+
}
31+
}
32+
}
33+
#[repr(C)]
34+
#[derive(Debug, Copy)]
35+
pub struct JSAutoCompartment {
36+
pub _address: u8,
37+
}
38+
#[test]
39+
fn bindgen_test_layout_JSAutoCompartment() {
40+
assert_eq!(::std::mem::size_of::<JSAutoCompartment>() , 1usize);
41+
assert_eq!(::std::mem::align_of::<JSAutoCompartment>() , 1usize);
42+
}
43+
extern "C" {
44+
#[link_name =
45+
"_ZN17JSAutoCompartmentC1EN7mozilla6detail19GuardObjectNotifierE"]
46+
pub fn JSAutoCompartment_JSAutoCompartment(this:
47+
*mut root::JSAutoCompartment,
48+
arg1:
49+
root::mozilla::detail::GuardObjectNotifier);
50+
}
51+
impl Clone for JSAutoCompartment {
52+
fn clone(&self) -> Self { *self }
53+
}
54+
impl JSAutoCompartment {
55+
#[inline]
56+
pub unsafe fn new(arg1: root::mozilla::detail::GuardObjectNotifier)
57+
-> Self {
58+
let mut __bindgen_tmp = ::std::mem::uninitialized();
59+
JSAutoCompartment_JSAutoCompartment(&mut __bindgen_tmp, arg1);
60+
__bindgen_tmp
61+
}
62+
}
63+
}

tests/headers/issue-447.hpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// bindgen-flags: --enable-cxx-namespaces --whitelist-type JSAutoCompartment -- -std=c++11
2+
3+
namespace mozilla {
4+
template <typename> class a {};
5+
namespace detail {
6+
class GuardObjectNotifier {};
7+
struct b;
8+
}
9+
class c {
10+
typedef detail::b d;
11+
};
12+
}
13+
namespace js {
14+
class D {
15+
mozilla::a<mozilla::c> e;
16+
};
17+
}
18+
struct f {
19+
js::D g;
20+
};
21+
namespace js {
22+
struct ContextFriendFields : f {};
23+
}
24+
class JSAutoCompartment {
25+
public:
26+
JSAutoCompartment(mozilla::detail::GuardObjectNotifier);
27+
};

0 commit comments

Comments
 (0)