diff options
-rw-r--r-- | src/ir/ty.rs | 14 | ||||
-rw-r--r-- | tests/expectations/tests/layout_array.rs | 10 | ||||
-rw-r--r-- | tests/expectations/tests/layout_mbuf.rs | 11 | ||||
-rw-r--r-- | tests/expectations/tests/template.rs | 11 |
4 files changed, 36 insertions, 10 deletions
diff --git a/src/ir/ty.rs b/src/ir/ty.rs index a98ca446..a47c1470 100644 --- a/src/ir/ty.rs +++ b/src/ir/ty.rs @@ -1026,9 +1026,7 @@ impl Type { CXType_MemberPointer | CXType_Pointer => { let inner = Item::from_ty_or_ref(ty.pointee_type().unwrap(), - location, - parent_id, - ctx); + location, None, ctx); TypeKind::Pointer(inner) } CXType_BlockPointer => TypeKind::BlockPointer, @@ -1038,7 +1036,7 @@ impl Type { CXType_LValueReference => { let inner = Item::from_ty_or_ref(ty.pointee_type().unwrap(), location, - parent_id, + None, ctx); TypeKind::Reference(inner) } @@ -1047,7 +1045,7 @@ impl Type { CXType_DependentSizedArray => { let inner = Item::from_ty(ty.elem_type().as_ref().unwrap(), location, - parent_id, + None, ctx) .expect("Not able to resolve array element?"); TypeKind::Pointer(inner) @@ -1055,7 +1053,7 @@ impl Type { CXType_IncompleteArray => { let inner = Item::from_ty(ty.elem_type().as_ref().unwrap(), location, - parent_id, + None, ctx) .expect("Not able to resolve array element?"); TypeKind::Array(inner, 0) @@ -1070,7 +1068,7 @@ impl Type { CXType_Typedef => { let inner = cursor.typedef_type().expect("Not valid Type?"); let inner = - Item::from_ty_or_ref(inner, location, parent_id, ctx); + Item::from_ty_or_ref(inner, location, None, ctx); TypeKind::Alias(inner) } CXType_Enum => { @@ -1092,7 +1090,7 @@ impl Type { CXType_ConstantArray => { let inner = Item::from_ty(ty.elem_type().as_ref().unwrap(), location, - parent_id, + None, ctx) .expect("Not able to resolve array element?"); TypeKind::Array(inner, ty.num_elements().unwrap()) diff --git a/tests/expectations/tests/layout_array.rs b/tests/expectations/tests/layout_array.rs index facf9462..c28d3ec8 100644 --- a/tests/expectations/tests/layout_array.rs +++ b/tests/expectations/tests/layout_array.rs @@ -200,7 +200,7 @@ pub struct malloc_heap { #[repr(C)] #[derive(Debug, Copy)] pub struct malloc_heap__bindgen_ty_1 { - pub lh_first: *mut malloc_heap__bindgen_ty_1_malloc_elem, + pub lh_first: *mut malloc_elem, } #[test] fn bindgen_test_layout_malloc_heap__bindgen_ty_1() { @@ -255,3 +255,11 @@ impl Clone for malloc_heap { impl Default for malloc_heap { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } +#[repr(C)] +#[derive(Debug, Default, Copy)] +pub struct malloc_elem { + pub _address: u8, +} +impl Clone for malloc_elem { + fn clone(&self) -> Self { *self } +} diff --git a/tests/expectations/tests/layout_mbuf.rs b/tests/expectations/tests/layout_mbuf.rs index 7bd3bf1a..189b50a5 100644 --- a/tests/expectations/tests/layout_mbuf.rs +++ b/tests/expectations/tests/layout_mbuf.rs @@ -98,7 +98,7 @@ pub struct rte_mbuf { pub cacheline1: MARKER, pub __bindgen_anon_3: rte_mbuf__bindgen_ty_4, /**< Pool from which mbuf was allocated. */ - pub pool: *mut rte_mbuf_rte_mempool, + pub pool: *mut rte_mempool, /**< Next segment of scattered packet. */ pub next: *mut rte_mbuf, pub __bindgen_anon_4: rte_mbuf__bindgen_ty_5, @@ -731,3 +731,12 @@ impl Clone for rte_mbuf { impl Default for rte_mbuf { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } +/**< Pool from which mbuf was allocated. */ +#[repr(C)] +#[derive(Debug, Default, Copy)] +pub struct rte_mempool { + pub _address: u8, +} +impl Clone for rte_mempool { + fn clone(&self) -> Self { *self } +} diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs index 131a54fd..3c829f07 100644 --- a/tests/expectations/tests/template.rs +++ b/tests/expectations/tests/template.rs @@ -258,6 +258,17 @@ fn __bindgen_test_layout_template_1() { } #[test] fn __bindgen_test_layout_template_2() { + assert_eq!(::std::mem::size_of::<Rooted<*mut ::std::os::raw::c_void>>() , + 24usize , concat ! ( + "Size of template specialization: " , stringify ! ( + Rooted<*mut ::std::os::raw::c_void> ) )); + assert_eq!(::std::mem::align_of::<Rooted<*mut ::std::os::raw::c_void>>() , + 8usize , concat ! ( + "Alignment of template specialization: " , stringify ! ( + Rooted<*mut ::std::os::raw::c_void> ) )); +} +#[test] +fn __bindgen_test_layout_template_3() { assert_eq!(::std::mem::size_of::<WithDtor<::std::os::raw::c_int>>() , 4usize , concat ! ( "Size of template specialization: " , stringify ! ( |