summaryrefslogtreecommitdiff
path: root/libbindgen/tests
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-01-19 08:15:31 -0800
committerGitHub <noreply@github.com>2017-01-19 08:15:31 -0800
commit36547ae216181fbcb1e3ec197e931ded17428e4c (patch)
tree1eab1c4c397b55b2d0cbf6ed95fd19150134fb1d /libbindgen/tests
parent77278fc0ea94de171ee93a1a6b0a8a9d7eeed052 (diff)
parente6a9291cb089da2a2b252f78658d125ffcd48802 (diff)
Auto merge of #397 - emilio:trace-vars, r=fitzgen
ir: Trace types across vars. r? @fitzgen
Diffstat (limited to 'libbindgen/tests')
-rw-r--r--libbindgen/tests/expectations/tests/var-tracing.rs48
-rw-r--r--libbindgen/tests/headers/var-tracing.hpp10
2 files changed, 58 insertions, 0 deletions
diff --git a/libbindgen/tests/expectations/tests/var-tracing.rs b/libbindgen/tests/expectations/tests/var-tracing.rs
new file mode 100644
index 00000000..75c5ebe3
--- /dev/null
+++ b/libbindgen/tests/expectations/tests/var-tracing.rs
@@ -0,0 +1,48 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Bar {
+ pub m_baz: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_Bar() {
+ assert_eq!(::std::mem::size_of::<Bar>() , 4usize);
+ assert_eq!(::std::mem::align_of::<Bar>() , 4usize);
+}
+extern "C" {
+ #[link_name = "_ZN3BarC1Ei"]
+ pub fn Bar_Bar(this: *mut Bar, baz: ::std::os::raw::c_int);
+}
+impl Clone for Bar {
+ fn clone(&self) -> Self { *self }
+}
+impl Bar {
+ #[inline]
+ pub unsafe fn new(baz: ::std::os::raw::c_int) -> Self {
+ let mut __bindgen_tmp = ::std::mem::uninitialized();
+ Bar_Bar(&mut __bindgen_tmp, baz);
+ __bindgen_tmp
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Baz {
+ pub _address: u8,
+}
+extern "C" {
+ #[link_name = "_ZN3Baz3FOOE"]
+ pub static mut Baz_FOO: *const Bar;
+}
+#[test]
+fn bindgen_test_layout_Baz() {
+ assert_eq!(::std::mem::size_of::<Baz>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Baz>() , 1usize);
+}
+impl Clone for Baz {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/libbindgen/tests/headers/var-tracing.hpp b/libbindgen/tests/headers/var-tracing.hpp
new file mode 100644
index 00000000..0d0b0cca
--- /dev/null
+++ b/libbindgen/tests/headers/var-tracing.hpp
@@ -0,0 +1,10 @@
+// bindgen-flags: --whitelist-type Baz
+
+struct Bar {
+ const int m_baz;
+ Bar(int baz);
+};
+
+class Baz {
+ static const Bar FOO[];
+};