Fix inline function identification

This commit is contained in:
kohanis 2022-11-09 17:24:27 +03:00 committed by Emilio Cobos Álvarez
parent c03b37697a
commit ed3aa90cd4
4 changed files with 71 additions and 47 deletions

View File

@ -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))
);
}

View File

@ -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() {
}

View File

@ -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() {}
}

View File

@ -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);
}