forked from adetaylor/rust-bindgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add attribute for C++ special members.
See google/autocxx#456 for details. If I was submitting this upstream, I would have put the information about special members directly in the MethodKind enum, but that would have been a pretty invasive change that could cause merge conflicts when merging from upstream. I've therefore decided to put add a separate enum that is used in as few places as possible.
- Loading branch information
1 parent
33e5e16
commit 388d43a
Showing
17 changed files
with
169 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#![allow( | ||
dead_code, | ||
non_snake_case, | ||
non_camel_case_types, | ||
non_upper_case_globals | ||
)] | ||
|
||
#[repr(C)] | ||
#[derive(Debug, Default)] | ||
pub struct A { | ||
pub _address: u8, | ||
} | ||
#[test] | ||
fn bindgen_test_layout_A() { | ||
assert_eq!( | ||
::std::mem::size_of::<A>(), | ||
1usize, | ||
concat!("Size of: ", stringify!(A)) | ||
); | ||
assert_eq!( | ||
::std::mem::align_of::<A>(), | ||
1usize, | ||
concat!("Alignment of ", stringify!(A)) | ||
); | ||
} | ||
extern "C" { | ||
#[bindgen_original_name("A")] | ||
#[bindgen_special_member("default_ctor")] | ||
#[link_name = "\u{1}_ZN1AC1Ev"] | ||
pub fn A_A(this: *mut A); | ||
} | ||
extern "C" { | ||
#[bindgen_arg_type_reference(arg1)] | ||
#[bindgen_original_name("A")] | ||
#[bindgen_special_member("copy_ctor")] | ||
#[link_name = "\u{1}_ZN1AC1ERS_"] | ||
pub fn A_A1(this: *mut A, arg1: *mut A); | ||
} | ||
extern "C" { | ||
#[bindgen_arg_type_reference(arg1)] | ||
#[bindgen_original_name("A")] | ||
#[bindgen_special_member("move_ctor")] | ||
#[link_name = "\u{1}_ZN1AC1EOS_"] | ||
pub fn A_A2(this: *mut A, arg1: *mut A); | ||
} | ||
extern "C" { | ||
#[bindgen_original_name("A_destructor")] | ||
#[bindgen_special_member("dtor")] | ||
#[link_name = "\u{1}_ZN1AD1Ev"] | ||
pub fn A_A_destructor(this: *mut A); | ||
} | ||
impl A { | ||
#[inline] | ||
pub unsafe fn new() -> Self { | ||
let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit(); | ||
A_A(__bindgen_tmp.as_mut_ptr()); | ||
__bindgen_tmp.assume_init() | ||
} | ||
#[bindgen_arg_type_reference(arg1)] | ||
#[inline] | ||
pub unsafe fn new1(arg1: *mut A) -> Self { | ||
let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit(); | ||
A_A1(__bindgen_tmp.as_mut_ptr(), arg1); | ||
__bindgen_tmp.assume_init() | ||
} | ||
#[bindgen_arg_type_reference(arg1)] | ||
#[inline] | ||
pub unsafe fn new2(arg1: *mut A) -> Self { | ||
let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit(); | ||
A_A2(__bindgen_tmp.as_mut_ptr(), arg1); | ||
__bindgen_tmp.assume_init() | ||
} | ||
#[inline] | ||
pub unsafe fn destruct(&mut self) { | ||
A_A_destructor(self) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class A { | ||
public: | ||
A(); | ||
A(A&); | ||
A(A&&); | ||
~A(); | ||
}; |