Skip to content

Commit 1f5b053

Browse files
Distinguish anonymous declarations
New type constructor `QualNameAnon` is added to the `QualName` type to distinguish anonymous declarations in binding specifications and select predicates. The string representation uses an `@` prefix. Example: `@SC_c` This character should not cause issues with regular expressions. This character is reserved for future use by YAML and must therefore be quoted. Example: ```yaml cname: '@S1_c' ```
1 parent 8a5c82e commit 1f5b053

26 files changed

+217
-200
lines changed

hs-bindgen/fixtures/anonymous.bindingspec.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,47 @@ types:
88
- Show
99
- Storable
1010
- headers: anonymous.h
11-
cname: S1_c
11+
cname: struct S2
1212
module: Example
13-
identifier: S1_c
13+
identifier: S2
1414
instances:
1515
- Eq
1616
- Show
1717
- Storable
1818
- headers: anonymous.h
19-
cname: struct S2
19+
cname: struct S3
2020
module: Example
21-
identifier: S2
21+
identifier: S3
2222
instances:
2323
- Eq
2424
- Show
2525
- Storable
2626
- headers: anonymous.h
27-
cname: S2_inner
27+
cname: '@S1_c'
2828
module: Example
29-
identifier: S2_inner
29+
identifier: S1_c
3030
instances:
3131
- Eq
3232
- Show
3333
- Storable
3434
- headers: anonymous.h
35-
cname: S2_inner_deep
35+
cname: '@S2_inner'
3636
module: Example
37-
identifier: S2_inner_deep
37+
identifier: S2_inner
3838
instances:
3939
- Eq
4040
- Show
4141
- Storable
4242
- headers: anonymous.h
43-
cname: struct S3
43+
cname: '@S2_inner_deep'
4444
module: Example
45-
identifier: S3
45+
identifier: S2_inner_deep
4646
instances:
4747
- Eq
4848
- Show
4949
- Storable
5050
- headers: anonymous.h
51-
cname: S3_c
51+
cname: '@S3_c'
5252
module: Example
5353
identifier: S3_c
5454
instances:

hs-bindgen/fixtures/attributes.bindingspec.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ types:
1616
- Show
1717
- Storable
1818
- headers: attributes.h
19-
cname: baz
19+
cname: struct foo
2020
module: Example
21-
identifier: Baz
21+
identifier: Foo
2222
instances:
2323
- Eq
2424
- Show
2525
- Storable
2626
- headers: attributes.h
27-
cname: struct foo
27+
cname: '@baz'
2828
module: Example
29-
identifier: Foo
29+
identifier: Baz
3030
instances:
3131
- Eq
3232
- Show
3333
- Storable
3434
- headers: attributes.h
35-
cname: qux
35+
cname: '@qux'
3636
module: Example
3737
identifier: Qux
3838
instances:

hs-bindgen/fixtures/distilled_lib_1.bindingspec.yaml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,65 +18,65 @@ types:
1818
- Real
1919
- Storable
2020
- headers: distilled_lib_1.h
21-
cname: a_typedef_enum_e
21+
cname: struct a_typedef_struct
2222
module: Example
23-
identifier: A_typedef_enum_e
23+
identifier: A_typedef_struct_t
2424
instances:
2525
- Eq
26-
- Ord
27-
- Read
2826
- Show
2927
- Storable
3028
- headers: distilled_lib_1.h
31-
cname: struct a_typedef_struct
29+
cname: callback_t
3230
module: Example
33-
identifier: A_typedef_struct_t
31+
identifier: Callback_t
3432
instances:
3533
- Eq
34+
- Ord
3635
- Show
3736
- Storable
3837
- headers: distilled_lib_1.h
39-
cname: another_typedef_enum_e
38+
cname: var_t
4039
module: Example
41-
identifier: Another_typedef_enum_e
40+
identifier: Var_t
4241
instances:
4342
- Eq
4443
- Ord
44+
- Enum
45+
- Ix
46+
- Bounded
4547
- Read
4648
- Show
49+
- Bits
50+
- FiniteBits
51+
- Integral
52+
- Num
53+
- Real
4754
- Storable
4855
- headers: distilled_lib_1.h
49-
cname: another_typedef_struct_t
56+
cname: '@a_typedef_enum_e'
5057
module: Example
51-
identifier: Another_typedef_struct_t
58+
identifier: A_typedef_enum_e
5259
instances:
5360
- Eq
61+
- Ord
62+
- Read
5463
- Show
5564
- Storable
5665
- headers: distilled_lib_1.h
57-
cname: callback_t
66+
cname: '@another_typedef_enum_e'
5867
module: Example
59-
identifier: Callback_t
68+
identifier: Another_typedef_enum_e
6069
instances:
6170
- Eq
6271
- Ord
72+
- Read
6373
- Show
6474
- Storable
6575
- headers: distilled_lib_1.h
66-
cname: var_t
76+
cname: '@another_typedef_struct_t'
6777
module: Example
68-
identifier: Var_t
78+
identifier: Another_typedef_struct_t
6979
instances:
7080
- Eq
71-
- Ord
72-
- Enum
73-
- Ix
74-
- Bounded
75-
- Read
7681
- Show
77-
- Bits
78-
- FiniteBits
79-
- Integral
80-
- Num
81-
- Real
8282
- Storable

hs-bindgen/fixtures/enum_cpp_syntax.bindingspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
types:
22
- headers: enum_cpp_syntax.h
3-
cname: foo_enum
3+
cname: '@foo_enum'
44
module: Example
55
identifier: Foo_enum
66
instances:

hs-bindgen/fixtures/enums.bindingspec.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
types:
2-
- headers: enums.h
3-
cname: enumA
4-
module: Example
5-
identifier: EnumA
6-
instances:
7-
- Eq
8-
- Ord
9-
- Read
10-
- Show
11-
- Storable
122
- headers: enums.h
133
cname: enum enumB
144
module: Example
@@ -89,3 +79,13 @@ types:
8979
- Read
9080
- Show
9181
- Storable
82+
- headers: enums.h
83+
cname: '@enumA'
84+
module: Example
85+
identifier: EnumA
86+
instances:
87+
- Eq
88+
- Ord
89+
- Read
90+
- Show
91+
- Storable

hs-bindgen/fixtures/flam.bindingspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ types:
1616
- Show
1717
- Storable
1818
- headers: flam.h
19-
cname: foo_bar
19+
cname: struct pascal
2020
module: Example
21-
identifier: Foo_bar
21+
identifier: Pascal
2222
instances:
2323
- Eq
2424
- Show
2525
- Storable
2626
- headers: flam.h
27-
cname: struct pascal
27+
cname: '@foo_bar'
2828
module: Example
29-
identifier: Pascal
29+
identifier: Foo_bar
3030
instances:
3131
- Eq
3232
- Show

hs-bindgen/fixtures/fun_attributes.bindingspec.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
types:
2-
- headers: fun_attributes.h
3-
cname: FILE
4-
module: Example
5-
identifier: FILE
6-
instances:
7-
- Eq
8-
- Show
9-
- Storable
102
- headers: fun_attributes.h
113
cname: size_t
124
module: Example
@@ -25,3 +17,11 @@ types:
2517
- Num
2618
- Real
2719
- Storable
20+
- headers: fun_attributes.h
21+
cname: '@FILE'
22+
module: Example
23+
identifier: FILE
24+
instances:
25+
- Eq
26+
- Show
27+
- Storable

hs-bindgen/fixtures/globals.bindingspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ types:
1616
- Show
1717
- Storable
1818
- headers: globals.h
19-
cname: struct1_t
19+
cname: '@struct1_t'
2020
module: Example
2121
identifier: Struct1_t
2222
instances:
2323
- Eq
2424
- Show
2525
- Storable
2626
- headers: globals.h
27-
cname: struct2_t
27+
cname: '@struct2_t'
2828
module: Example
2929
identifier: Struct2_t
3030
instances:
3131
- Eq
3232
- Show
3333
- Storable
3434
- headers: globals.h
35-
cname: version_t
35+
cname: '@version_t'
3636
module: Example
3737
identifier: Version_t
3838
instances:

hs-bindgen/fixtures/macro_in_fundecl_vs_typedef.bindingspec.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ types:
4343
- Eq
4444
- Show
4545
- Storable
46-
- headers: macro_in_fundecl_vs_typedef.h
47-
cname: struct2
48-
module: Example
49-
identifier: Struct2
50-
instances:
51-
- Eq
52-
- Show
53-
- Storable
5446
- headers: macro_in_fundecl_vs_typedef.h
5547
cname: struct struct3
5648
module: Example
@@ -75,3 +67,11 @@ types:
7567
- Eq
7668
- Show
7769
- Storable
70+
- headers: macro_in_fundecl_vs_typedef.h
71+
cname: '@struct2'
72+
module: Example
73+
identifier: Struct2
74+
instances:
75+
- Eq
76+
- Show
77+
- Storable

hs-bindgen/fixtures/macro_typedef_struct.bindingspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ types:
1818
- Real
1919
- Storable
2020
- headers: macro_typedef_struct.h
21-
cname: bar
21+
cname: '@bar'
2222
module: Example
2323
identifier: Bar
2424
instances:

0 commit comments

Comments
 (0)