mirror of
https://gitee.com/openharmony/third_party_rust_bindgen
synced 2025-03-02 19:55:59 +00:00
Fix inline function identification
This commit is contained in:
parent
c03b37697a
commit
ed3aa90cd4
@ -1,35 +1,53 @@
|
||||
#![allow(
|
||||
dead_code,
|
||||
non_snake_case,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals
|
||||
)]
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct cv_String {
|
||||
pub _address: u8,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_cv_String() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<cv_String>(),
|
||||
1usize,
|
||||
concat!("Size of: ", stringify!(cv_String))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<cv_String>(),
|
||||
1usize,
|
||||
concat!("Alignment of ", stringify!(cv_String))
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
#[link_name = "\u{1}_ZN2cv6StringD1Ev"]
|
||||
pub fn cv_String_String_destructor(this: *mut cv_String);
|
||||
}
|
||||
impl cv_String {
|
||||
#[inline]
|
||||
pub unsafe fn destruct(&mut self) {
|
||||
unsafe { cv_String_String_destructor(self) }
|
||||
}
|
||||
}
|
||||
#![allow(
|
||||
dead_code,
|
||||
non_snake_case,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals
|
||||
)]
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct cv_Foo {
|
||||
pub _address: u8,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_cv_Foo() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<cv_Foo>(),
|
||||
1usize,
|
||||
concat!("Size of: ", stringify!(cv_Foo))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<cv_Foo>(),
|
||||
1usize,
|
||||
concat!("Alignment of ", stringify!(cv_Foo))
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
#[link_name = "\u{1}_ZN2cv3FooD1Ev"]
|
||||
pub fn cv_Foo_Foo_destructor(this: *mut cv_Foo);
|
||||
}
|
||||
impl cv_Foo {
|
||||
#[inline]
|
||||
pub unsafe fn destruct(&mut self) {
|
||||
unsafe { cv_Foo_Foo_destructor(self) }
|
||||
}
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct cv_Bar {
|
||||
pub _address: u8,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_cv_Bar() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<cv_Bar>(),
|
||||
1usize,
|
||||
concat!("Size of: ", stringify!(cv_Bar))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<cv_Bar>(),
|
||||
1usize,
|
||||
concat!("Alignment of ", stringify!(cv_Bar))
|
||||
);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ public:
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline void
|
||||
void
|
||||
Foo<T>::doBaz() {
|
||||
}
|
||||
|
||||
@ -21,6 +21,5 @@ template<typename T>
|
||||
Foo<T>::Foo() {
|
||||
}
|
||||
|
||||
inline
|
||||
Bar::Bar() {
|
||||
}
|
||||
|
@ -1,15 +1,18 @@
|
||||
|
||||
|
||||
namespace cv {
|
||||
class String {
|
||||
public:
|
||||
~String();
|
||||
};
|
||||
class Foo {
|
||||
public:
|
||||
~Foo();
|
||||
};
|
||||
|
||||
Foo::~Foo() {}
|
||||
|
||||
inline
|
||||
String::~String()
|
||||
{
|
||||
}
|
||||
class Bar {
|
||||
public:
|
||||
~Bar();
|
||||
};
|
||||
|
||||
inline
|
||||
Bar::~Bar() {}
|
||||
|
||||
}
|
||||
|
@ -675,7 +675,11 @@ impl ClangSubItemParser for Function {
|
||||
return Err(ParseError::Continue);
|
||||
}
|
||||
|
||||
if cursor.is_inlined_function() {
|
||||
if cursor.is_inlined_function() ||
|
||||
cursor
|
||||
.definition()
|
||||
.map_or(false, |x| x.is_inlined_function())
|
||||
{
|
||||
if !context.options().generate_inline_functions {
|
||||
return Err(ParseError::Continue);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user