diff options
-rw-r--r-- | src/codegen/mod.rs | 4 | ||||
-rw-r--r-- | tests/expectations/tests/blacklist-function.rs | 18 | ||||
-rw-r--r-- | tests/headers/blacklist-function.hpp | 7 |
3 files changed, 28 insertions, 1 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 408d88bf..8344c4d1 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -2146,6 +2146,10 @@ impl MethodCodegen for Method { // First of all, output the actual function. let function_item = ctx.resolve_item(self.signature()); + if function_item.is_blacklisted(ctx) { + // We shouldn't emit a method declaration if the function is blacklisted + return; + } function_item.codegen(ctx, result, &()); let function = function_item.expect_function(); diff --git a/tests/expectations/tests/blacklist-function.rs b/tests/expectations/tests/blacklist-function.rs index b1d55643..5c4e8497 100644 --- a/tests/expectations/tests/blacklist-function.rs +++ b/tests/expectations/tests/blacklist-function.rs @@ -23,4 +23,22 @@ pub mod root { pub fn NamespacedFunction(); } } + #[repr(C)] + #[derive(Debug, Default, Copy, Clone)] + pub struct C { + pub _address: u8, + } + #[test] + fn bindgen_test_layout_C() { + assert_eq!( + ::std::mem::size_of::<C>(), + 1usize, + concat!("Size of: ", stringify!(C)) + ); + assert_eq!( + ::std::mem::align_of::<C>(), + 1usize, + concat!("Alignment of ", stringify!(C)) + ); + } } diff --git a/tests/headers/blacklist-function.hpp b/tests/headers/blacklist-function.hpp index c4a923fc..8087295c 100644 --- a/tests/headers/blacklist-function.hpp +++ b/tests/headers/blacklist-function.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --blacklist-function "ExternFunction" --blacklist-function "foo::NamespacedFunction" --enable-cxx-namespaces +// bindgen-flags: --blacklist-function "ExternFunction" --blacklist-function "foo::NamespacedFunction" --blacklist-function "C_ClassMethod" --enable-cxx-namespaces extern "C" void ExternFunction(); @@ -9,3 +9,8 @@ namespace foo { namespace bar { void NamespacedFunction(); } + +class C { +public: + void ClassMethod(); +}; |