diff --git a/bindgen-tests/tests/expectations/tests/public-dtor.rs b/bindgen-tests/tests/expectations/tests/public-dtor.rs index f9559a08..1d095b8d 100644 --- a/bindgen-tests/tests/expectations/tests/public-dtor.rs +++ b/bindgen-tests/tests/expectations/tests/public-dtor.rs @@ -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::(), - 1usize, - concat!("Size of: ", stringify!(cv_String)) - ); - assert_eq!( - ::std::mem::align_of::(), - 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::(), + 1usize, + concat!("Size of: ", stringify!(cv_Foo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 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::(), + 1usize, + concat!("Size of: ", stringify!(cv_Bar)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(cv_Bar)) + ); +} diff --git a/bindgen-tests/tests/headers/constructor-tp.hpp b/bindgen-tests/tests/headers/constructor-tp.hpp index 6e55ea78..3b5d5407 100644 --- a/bindgen-tests/tests/headers/constructor-tp.hpp +++ b/bindgen-tests/tests/headers/constructor-tp.hpp @@ -8,7 +8,7 @@ public: }; template -inline void +void Foo::doBaz() { } @@ -21,6 +21,5 @@ template Foo::Foo() { } -inline Bar::Bar() { } diff --git a/bindgen-tests/tests/headers/public-dtor.hpp b/bindgen-tests/tests/headers/public-dtor.hpp index 5d4fb592..60d69d79 100644 --- a/bindgen-tests/tests/headers/public-dtor.hpp +++ b/bindgen-tests/tests/headers/public-dtor.hpp @@ -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() {} } diff --git a/bindgen/ir/function.rs b/bindgen/ir/function.rs index 52346f6c..7dbbb8f8 100644 --- a/bindgen/ir/function.rs +++ b/bindgen/ir/function.rs @@ -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); }