summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-01-26 16:40:20 -0800
committerGitHub <noreply@github.com>2017-01-26 16:40:20 -0800
commit7bfb5a52ea3ec9099068162efc45f8e3e50c2989 (patch)
tree1b4f727d198253414b307f33e8c587145c75fee3
parentf9e494d02096677fec5029484db8c8758e1fcb30 (diff)
parent44ed608a55cbdde778b9abd95e9953a9b14fc40e (diff)
Auto merge of #448 - fitzgen:trace-constructors, r=emilio
Trace constructors r? @emilio
-rw-r--r--src/codegen/mod.rs1
-rw-r--r--src/ir/comp.rs4
-rw-r--r--tests/expectations/tests/issue-447.rs63
-rw-r--r--tests/headers/issue-447.hpp27
4 files changed, 95 insertions, 0 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index b4ef8606..3a5ae690 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -287,6 +287,7 @@ impl CodeGenerator for Item {
}
debug!("<Item as CodeGenerator>::codegen: self = {:?}", self);
+ assert!(whitelisted_items.contains(&self.id()));
result.set_seen(self.id());
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);
+};