-
Notifications
You must be signed in to change notification settings - Fork 748
analysis: Account for template instantiations of opaque types in the derive debug analysis. #842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* automatically generated by rust-bindgen */ | ||
|
||
|
||
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] | ||
|
||
|
||
#[repr(C)] | ||
#[derive(Copy, Clone)] | ||
pub struct OpaqueTemplate { | ||
} | ||
impl Default for OpaqueTemplate { | ||
fn default() -> Self { unsafe { ::std::mem::zeroed() } } | ||
} | ||
#[repr(C)] | ||
#[derive(Debug, Default, Copy)] | ||
pub struct ContainsOpaqueTemplate { | ||
pub mBlah: [u32; 11usize], | ||
pub mBaz: ::std::os::raw::c_int, | ||
} | ||
#[test] | ||
fn bindgen_test_layout_ContainsOpaqueTemplate() { | ||
assert_eq!(::std::mem::size_of::<ContainsOpaqueTemplate>() , 48usize , | ||
concat ! ( "Size of: " , stringify ! ( ContainsOpaqueTemplate ) | ||
)); | ||
assert_eq! (::std::mem::align_of::<ContainsOpaqueTemplate>() , 4usize , | ||
concat ! ( | ||
"Alignment of " , stringify ! ( ContainsOpaqueTemplate ) )); | ||
assert_eq! (unsafe { | ||
& ( * ( 0 as * const ContainsOpaqueTemplate ) ) . mBlah as * | ||
const _ as usize } , 0usize , concat ! ( | ||
"Alignment of field: " , stringify ! ( ContainsOpaqueTemplate | ||
) , "::" , stringify ! ( mBlah ) )); | ||
assert_eq! (unsafe { | ||
& ( * ( 0 as * const ContainsOpaqueTemplate ) ) . mBaz as * | ||
const _ as usize } , 44usize , concat ! ( | ||
"Alignment of field: " , stringify ! ( ContainsOpaqueTemplate | ||
) , "::" , stringify ! ( mBaz ) )); | ||
} | ||
impl Clone for ContainsOpaqueTemplate { | ||
fn clone(&self) -> Self { *self } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// bindgen-flags: --opaque-type 'OpaqueTemplate' | ||
|
||
template<typename T> | ||
class OpaqueTemplate { | ||
T mData; | ||
bool mCannotDebug[40]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think instantiating with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or s/40/400/ |
||
}; | ||
|
||
class ContainsOpaqueTemplate { | ||
OpaqueTemplate<int> mBlah; | ||
int mBaz; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole point was to ensure that this doesn't derive debug, right?