Skip to content

Commit b8082f1

Browse files
committed
Annotate typedefs with their underlying type
This makes typedef erasure a local operation, and now we no longer need a mapping of typedef names to typedef definitions.
1 parent 82752b4 commit b8082f1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3448
-555
lines changed

hs-bindgen/fixtures/array.hs

Lines changed: 307 additions & 42 deletions
Large diffs are not rendered by default.

hs-bindgen/fixtures/array.tree-diff.txt

Lines changed: 127 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,13 @@ TranslationUnit {
431431
NamePair {
432432
nameC = Name "triplet",
433433
nameHsIdent = Identifier
434-
"Triplet"}))},
434+
"Triplet"}
435+
(TypeConstArray
436+
3
437+
(TypePrim
438+
(PrimIntegral
439+
PrimInt
440+
Signed)))))},
435441
declSpec = DeclSpec
436442
CTypeSpec {
437443
cTypeSpecModule = Nothing,
@@ -497,7 +503,13 @@ TranslationUnit {
497503
NamePair {
498504
nameC = Name "triplet",
499505
nameHsIdent = Identifier
500-
"Triplet"})),
506+
"Triplet"}
507+
(TypeConstArray
508+
3
509+
(TypePrim
510+
(PrimIntegral
511+
PrimInt
512+
Signed))))),
501513
declSpec = DeclSpec
502514
CTypeSpec {
503515
cTypeSpecModule = Nothing,
@@ -561,8 +573,12 @@ TranslationUnit {
561573
(TypedefRegular
562574
NamePair {
563575
nameC = Name "list",
564-
nameHsIdent = Identifier
565-
"List"})),
576+
nameHsIdent = Identifier "List"}
577+
(TypeIncompleteArray
578+
(TypePrim
579+
(PrimIntegral
580+
PrimInt
581+
Signed))))),
566582
declSpec = DeclSpec
567583
CTypeSpec {
568584
cTypeSpecModule = Nothing,
@@ -632,7 +648,15 @@ TranslationUnit {
632648
NamePair {
633649
nameC = Name "matrix",
634650
nameHsIdent = Identifier
635-
"Matrix"})),
651+
"Matrix"}
652+
(TypeConstArray
653+
4
654+
(TypeConstArray
655+
3
656+
(TypePrim
657+
(PrimIntegral
658+
PrimInt
659+
Signed)))))),
636660
declSpec = DeclSpec
637661
CTypeSpec {
638662
cTypeSpecModule = Nothing,
@@ -701,7 +725,14 @@ TranslationUnit {
701725
NamePair {
702726
nameC = Name "tripletlist",
703727
nameHsIdent = Identifier
704-
"Tripletlist"})),
728+
"Tripletlist"}
729+
(TypeIncompleteArray
730+
(TypeConstArray
731+
3
732+
(TypePrim
733+
(PrimIntegral
734+
PrimInt
735+
Signed)))))),
705736
declSpec = DeclSpec
706737
CTypeSpec {
707738
cTypeSpecModule = Nothing,
@@ -795,7 +826,13 @@ TranslationUnit {
795826
NamePair {
796827
nameC = Name "triplet",
797828
nameHsIdent = Identifier
798-
"Triplet"}))],
829+
"Triplet"}
830+
(TypeConstArray
831+
3
832+
(TypePrim
833+
(PrimIntegral
834+
PrimInt
835+
Signed)))))],
799836
functionAttrs =
800837
FunctionAttributes
801838
ImpureFunction,
@@ -885,8 +922,12 @@ TranslationUnit {
885922
(TypedefRegular
886923
NamePair {
887924
nameC = Name "list",
888-
nameHsIdent = Identifier
889-
"List"}))],
925+
nameHsIdent = Identifier "List"}
926+
(TypeIncompleteArray
927+
(TypePrim
928+
(PrimIntegral
929+
PrimInt
930+
Signed)))))],
890931
functionAttrs =
891932
FunctionAttributes
892933
ImpureFunction,
@@ -980,7 +1021,15 @@ TranslationUnit {
9801021
NamePair {
9811022
nameC = Name "matrix",
9821023
nameHsIdent = Identifier
983-
"Matrix"}))],
1024+
"Matrix"}
1025+
(TypeConstArray
1026+
4
1027+
(TypeConstArray
1028+
3
1029+
(TypePrim
1030+
(PrimIntegral
1031+
PrimInt
1032+
Signed))))))],
9841033
functionAttrs =
9851034
FunctionAttributes
9861035
ImpureFunction,
@@ -1073,7 +1122,14 @@ TranslationUnit {
10731122
NamePair {
10741123
nameC = Name "tripletlist",
10751124
nameHsIdent = Identifier
1076-
"Tripletlist"}))],
1125+
"Tripletlist"}
1126+
(TypeIncompleteArray
1127+
(TypeConstArray
1128+
3
1129+
(TypePrim
1130+
(PrimIntegral
1131+
PrimInt
1132+
Signed))))))],
10771133
functionAttrs =
10781134
FunctionAttributes
10791135
ImpureFunction,
@@ -1119,7 +1175,21 @@ TranslationUnit {
11191175
NamePair {
11201176
nameC = Name "sudoku",
11211177
nameHsIdent = Identifier
1122-
"Sudoku"}))],
1178+
"Sudoku"}
1179+
(TypeConstArray
1180+
3
1181+
(TypeTypedef
1182+
(TypedefRegular
1183+
NamePair {
1184+
nameC = Name "triplet",
1185+
nameHsIdent = Identifier
1186+
"Triplet"}
1187+
(TypeConstArray
1188+
3
1189+
(TypePrim
1190+
(PrimIntegral
1191+
PrimInt
1192+
Signed))))))))],
11231193
functionAttrs =
11241194
FunctionAttributes
11251195
ImpureFunction,
@@ -1204,7 +1274,13 @@ TranslationUnit {
12041274
NamePair {
12051275
nameC = Name "triplet",
12061276
nameHsIdent = Identifier
1207-
"Triplet"}))},
1277+
"Triplet"}
1278+
(TypeConstArray
1279+
3
1280+
(TypePrim
1281+
(PrimIntegral
1282+
PrimInt
1283+
Signed)))))},
12081284
declSpec = DeclSpec
12091285
CTypeSpec {
12101286
cTypeSpecModule = Nothing,
@@ -1282,8 +1358,12 @@ TranslationUnit {
12821358
(TypedefRegular
12831359
NamePair {
12841360
nameC = Name "list",
1285-
nameHsIdent = Identifier
1286-
"List"}))},
1361+
nameHsIdent = Identifier "List"}
1362+
(TypeIncompleteArray
1363+
(TypePrim
1364+
(PrimIntegral
1365+
PrimInt
1366+
Signed)))))},
12871367
declSpec = DeclSpec
12881368
CTypeSpec {
12891369
cTypeSpecModule = Nothing,
@@ -1365,7 +1445,15 @@ TranslationUnit {
13651445
NamePair {
13661446
nameC = Name "matrix",
13671447
nameHsIdent = Identifier
1368-
"Matrix"}))},
1448+
"Matrix"}
1449+
(TypeConstArray
1450+
4
1451+
(TypeConstArray
1452+
3
1453+
(TypePrim
1454+
(PrimIntegral
1455+
PrimInt
1456+
Signed))))))},
13691457
declSpec = DeclSpec
13701458
CTypeSpec {
13711459
cTypeSpecModule = Nothing,
@@ -1446,7 +1534,14 @@ TranslationUnit {
14461534
NamePair {
14471535
nameC = Name "tripletlist",
14481536
nameHsIdent = Identifier
1449-
"Tripletlist"}))},
1537+
"Tripletlist"}
1538+
(TypeIncompleteArray
1539+
(TypeConstArray
1540+
3
1541+
(TypePrim
1542+
(PrimIntegral
1543+
PrimInt
1544+
Signed))))))},
14501545
declSpec = DeclSpec
14511546
CTypeSpec {
14521547
cTypeSpecModule = Nothing,
@@ -1486,7 +1581,21 @@ TranslationUnit {
14861581
NamePair {
14871582
nameC = Name "sudoku",
14881583
nameHsIdent = Identifier
1489-
"Sudoku"}))},
1584+
"Sudoku"}
1585+
(TypeConstArray
1586+
3
1587+
(TypeTypedef
1588+
(TypedefRegular
1589+
NamePair {
1590+
nameC = Name "triplet",
1591+
nameHsIdent = Identifier
1592+
"Triplet"}
1593+
(TypeConstArray
1594+
3
1595+
(TypePrim
1596+
(PrimIntegral
1597+
PrimInt
1598+
Signed))))))))},
14901599
declSpec = DeclSpec
14911600
CTypeSpec {
14921601
cTypeSpecModule = Nothing,

0 commit comments

Comments
 (0)