Skip to content

Commit 7fa3e36

Browse files
committed
Implement --emit-symbol-list
The test recreates the motivating situation in the issue, where there are two bindgen invocations, and we want them to build upon each other, not duplicate each other. Fix #3326
1 parent 953fc76 commit 7fa3e36

File tree

16 files changed

+448
-0
lines changed

16 files changed

+448
-0
lines changed

Cargo.lock

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ quickcheck = "1.0"
4242
quote = { version = "1", default-features = false }
4343
regex = { version = "1.5.3", default-features = false }
4444
rustc-hash = "2.1.0"
45+
serde = { version = "1.0", features = ["derive"] }
46+
serde_json = "1.0"
4547
shlex = "1"
4648
similar = "2.2.1"
4749
syn = "2.0"

bindgen-tests/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ owo-colors.workspace = true
1313
prettyplease = { workspace = true, features = ["verbatim"] }
1414
proc-macro2.workspace = true
1515
regex.workspace = true
16+
serde.workspace = true
17+
serde_json.workspace = true
1618
shlex.workspace = true
1719
similar = { workspace = true, features = ["inline"] }
1820
syn.workspace = true

bindgen-tests/tests/expectations/tests/emit-symbol-list-bar.rs

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/emit-symbol-list-foo.rs

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"types": [
3+
"foo_int_t",
4+
"int",
5+
"foo_struct",
6+
"int",
7+
"float",
8+
"_bindgen_ty_id_9",
9+
"int",
10+
"void",
11+
"int"
12+
],
13+
"functions": [
14+
"foo_function"
15+
],
16+
"vars": [
17+
"foo_global_var"
18+
]
19+
}

bindgen-tests/tests/expectations/tests/emit-symbol-list.rs

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
type my_int_t
2+
type int
3+
type my_struct
4+
type int
5+
type float
6+
type _bindgen_ty_id_9
7+
type int
8+
type void
9+
function my_function
10+
type int
11+
var my_global_var
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Dependent library header (like "bar" in the issue)
2+
// bar depends on foo
3+
4+
#include "emit-symbol-list-foo.h"
5+
6+
typedef foo_int_t bar_int_t;
7+
8+
struct bar_struct {
9+
struct foo_struct foo;
10+
int z;
11+
};
12+
13+
void bar_function(struct foo_struct* arg, struct bar_struct* arg2);
14+
15+
extern int bar_global_var;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Base library header (like "foo" in the issue)
2+
3+
typedef int foo_int_t;
4+
5+
struct foo_struct {
6+
int x;
7+
float y;
8+
};
9+
10+
void foo_function(int arg);
11+
12+
extern int foo_global_var;

0 commit comments

Comments
 (0)