summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/expectations/tests/issue-848-replacement-system-include.rs24
-rw-r--r--tests/headers/issue-848-replacement-system-include.hpp7
-rw-r--r--tests/headers/issue-848/an-include.h17
3 files changed, 48 insertions, 0 deletions
diff --git a/tests/expectations/tests/issue-848-replacement-system-include.rs b/tests/expectations/tests/issue-848-replacement-system-include.rs
new file mode 100644
index 00000000..14083705
--- /dev/null
+++ b/tests/expectations/tests/issue-848-replacement-system-include.rs
@@ -0,0 +1,24 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
+
+
+/// This is intended to replace another type, but won't if we treat this include
+/// as a system include, because clang doesn't parse comments there.
+///
+/// See #848.
+///
+/// <div rustbindgen replaces="nsTArray"></div>
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct nsTArray<T> {
+ pub m: *mut T,
+ pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
+}
+impl <T> Default for nsTArray<T> {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+}
+extern "C" {
+ pub fn func() -> *mut nsTArray<::std::os::raw::c_int>;
+}
diff --git a/tests/headers/issue-848-replacement-system-include.hpp b/tests/headers/issue-848-replacement-system-include.hpp
new file mode 100644
index 00000000..e95c823f
--- /dev/null
+++ b/tests/headers/issue-848-replacement-system-include.hpp
@@ -0,0 +1,7 @@
+// bindgen-flags: -- -Itests/headers/issue-848
+
+#include "an-include.h"
+
+extern "C" {
+ nsTArray<int>* func();
+}
diff --git a/tests/headers/issue-848/an-include.h b/tests/headers/issue-848/an-include.h
new file mode 100644
index 00000000..0421d19f
--- /dev/null
+++ b/tests/headers/issue-848/an-include.h
@@ -0,0 +1,17 @@
+template<typename T>
+class nsTArray {
+ void* mBuffer;
+};
+
+/**
+ * This is intended to replace another type, but won't if we treat this include
+ * as a system include, because clang doesn't parse comments there.
+ *
+ * See #848.
+ *
+ * <div rustbindgen replaces="nsTArray"></div>
+ */
+template<typename T>
+class nsTArray_Simple {
+ T* m;
+};