summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbindgen/tests/expectations/tests/opaque-tracing.rs23
-rw-r--r--libbindgen/tests/headers/opaque-tracing.hpp21
2 files changed, 44 insertions, 0 deletions
diff --git a/libbindgen/tests/expectations/tests/opaque-tracing.rs b/libbindgen/tests/expectations/tests/opaque-tracing.rs
new file mode 100644
index 00000000..7dcc4eef
--- /dev/null
+++ b/libbindgen/tests/expectations/tests/opaque-tracing.rs
@@ -0,0 +1,23 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Container {
+ pub _bindgen_opaque_blob: [u32; 2usize],
+}
+#[test]
+fn bindgen_test_layout_Container() {
+ assert_eq!(::std::mem::size_of::<Container>() , 8usize);
+ assert_eq!(::std::mem::align_of::<Container>() , 4usize);
+}
+impl Clone for Container {
+ fn clone(&self) -> Self { *self }
+}
+extern "C" {
+ #[link_name = "_Z3fooP9Container"]
+ pub fn foo(c: *mut Container);
+}
diff --git a/libbindgen/tests/headers/opaque-tracing.hpp b/libbindgen/tests/headers/opaque-tracing.hpp
new file mode 100644
index 00000000..7356245e
--- /dev/null
+++ b/libbindgen/tests/headers/opaque-tracing.hpp
@@ -0,0 +1,21 @@
+// bindgen-flags: --opaque-type=.* --whitelist-function=foo
+
+class Container;
+
+// The whitelist tracing should reach the Container type, even though it's
+// marked as opaque.
+void foo(Container* c);
+
+template<typename T>
+class Wat {
+ T foo;
+};
+
+class OtherOpaque {
+ int bar;
+};
+
+class Container {
+ Wat<int> bar;
+ OtherOpaque baz;
+};