Skip to content

Commit 7bfb5a5

Browse files
author
bors-servo
authored
Auto merge of #448 - fitzgen:trace-constructors, r=emilio
Trace constructors r? @emilio
2 parents f9e494d + 44ed608 commit 7bfb5a5

File tree

4 files changed

+95
-0
lines changed

4 files changed

+95
-0
lines changed

src/codegen/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ impl CodeGenerator for Item {
287287
}
288288

289289
debug!("<Item as CodeGenerator>::codegen: self = {:?}", self);
290+
assert!(whitelisted_items.contains(&self.id()));
290291

291292
result.set_seen(self.id());
292293

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)