summaryrefslogtreecommitdiff
path: root/libbindgen/tests
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-01-14 15:37:13 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-01-15 16:17:51 +0100
commit01cb681c17003cea2af9d7e641f9b97ded4bfcc5 (patch)
treeea37d453cb0ec9f0a868682e8b2d1e55bb092a80 /libbindgen/tests
parentb570ce853e33bfcfa05dd339bf432377c4a2fab8 (diff)
ir: Trace types across vars.
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[];
+};