Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/bindgen/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ impl Library {
}

pub fn generate(mut self) -> Result<Bindings, Error> {
self.remove_excluded();
self.transfer_annotations();
self.simplify_standard_types();

Expand All @@ -67,7 +66,10 @@ impl Library {

if self.config.language == Language::C {
self.instantiate_monomorphs();
self.remove_excluded();
self.resolve_declaration_types();
} else {
self.remove_excluded();
}

self.rename_items();
Expand Down
15 changes: 15 additions & 0 deletions tests/expectations/both/exclude_generic_monomorph.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <stdint.h>

typedef uint64_t Option_Foo;


#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

typedef struct Bar {
Option_Foo foo;
} Bar;

void root(Bar f);
23 changes: 23 additions & 0 deletions tests/expectations/both/exclude_generic_monomorph.compat.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <stdint.h>

typedef uint64_t Option_Foo;


#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

typedef struct Bar {
Option_Foo foo;
} Bar;

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

void root(Bar f);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
15 changes: 15 additions & 0 deletions tests/expectations/exclude_generic_monomorph.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <stdint.h>

typedef uint64_t Option_Foo;


#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

typedef struct {
Option_Foo foo;
} Bar;

void root(Bar f);
23 changes: 23 additions & 0 deletions tests/expectations/exclude_generic_monomorph.compat.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <stdint.h>

typedef uint64_t Option_Foo;


#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

typedef struct {
Option_Foo foo;
} Bar;

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

void root(Bar f);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
15 changes: 15 additions & 0 deletions tests/expectations/exclude_generic_monomorph.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <stdint.h>

typedef uint64_t Option_Foo;


#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

typedef struct {
Option_Foo foo;
} Bar;

void root(Bar f);
15 changes: 15 additions & 0 deletions tests/expectations/tag/exclude_generic_monomorph.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <stdint.h>

typedef uint64_t Option_Foo;


#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

struct Bar {
Option_Foo foo;
};

void root(struct Bar f);
23 changes: 23 additions & 0 deletions tests/expectations/tag/exclude_generic_monomorph.compat.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <stdint.h>

typedef uint64_t Option_Foo;


#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

struct Bar {
Option_Foo foo;
};

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

void root(struct Bar f);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
10 changes: 10 additions & 0 deletions tests/rust/exclude_generic_monomorph.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#[repr(transparent)]
pub struct Foo(NonZeroU64);

#[repr(C)]
pub struct Bar {
foo: Option<Foo>,
}

#[no_mangle]
pub extern "C" fn root(f: Bar) {}
11 changes: 11 additions & 0 deletions tests/rust/exclude_generic_monomorph.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language = "C"
header = """
#include <stdint.h>

typedef uint64_t Option_Foo;
"""

[export]
exclude = [
"Option_Foo",
]