| ... | ... | @@ -66,10 +66,15 @@ pub const Type = extern union { |
| 66 | 66 | .function => return .Fn, |
| 67 | 67 | |
| 68 | 68 | .array, .array_u8_sentinel_0, .array_u8, .array_sentinel => return .Array, |
| 69 | | .single_const_pointer => return .Pointer, |
| 70 | | .single_mut_pointer => return .Pointer, |
| 71 | | .single_const_pointer_to_comptime_int => return .Pointer, |
| 72 | | .const_slice_u8 => return .Pointer, |
| 69 | .single_const_pointer_to_comptime_int, |
| 70 | .const_slice_u8, |
| 71 | .single_const_pointer, |
| 72 | .single_mut_pointer, |
| 73 | .many_const_pointer, |
| 74 | .many_mut_pointer, |
| 75 | .c_const_pointer, |
| 76 | .c_mut_pointer, |
| 77 | => return .Pointer, |
| 73 | 78 | |
| 74 | 79 | .optional, |
| 75 | 80 | .optional_single_const_pointer, |
| ... | ... | @@ -108,13 +113,17 @@ pub const Type = extern union { |
| 108 | 113 | return @fieldParentPtr(T, "base", self.ptr_otherwise); |
| 109 | 114 | } |
| 110 | 115 | |
| 111 | | pub fn castPointer(self: Type) ?*Payload.Pointer { |
| 116 | pub fn castPointer(self: Type) ?*Payload.PointerSimple { |
| 112 | 117 | return switch (self.tag()) { |
| 113 | 118 | .single_const_pointer, |
| 114 | 119 | .single_mut_pointer, |
| 120 | .many_const_pointer, |
| 121 | .many_mut_pointer, |
| 122 | .c_const_pointer, |
| 123 | .c_mut_pointer, |
| 115 | 124 | .optional_single_const_pointer, |
| 116 | 125 | .optional_single_mut_pointer, |
| 117 | | => @fieldParentPtr(Payload.Pointer, "base", self.ptr_otherwise), |
| 126 | => @fieldParentPtr(Payload.PointerSimple, "base", self.ptr_otherwise), |
| 118 | 127 | else => null, |
| 119 | 128 | }; |
| 120 | 129 | } |
| ... | ... | @@ -198,8 +207,8 @@ pub const Type = extern union { |
| 198 | 207 | return true; |
| 199 | 208 | }, |
| 200 | 209 | .Optional => { |
| 201 | | var buf_a: Payload.Pointer = undefined; |
| 202 | | var buf_b: Payload.Pointer = undefined; |
| 210 | var buf_a: Payload.PointerSimple = undefined; |
| 211 | var buf_b: Payload.PointerSimple = undefined; |
| 203 | 212 | return a.optionalChild(&buf_a).eql(b.optionalChild(&buf_b)); |
| 204 | 213 | }, |
| 205 | 214 | .Float, |
| ... | ... | @@ -263,7 +272,7 @@ pub const Type = extern union { |
| 263 | 272 | } |
| 264 | 273 | }, |
| 265 | 274 | .Optional => { |
| 266 | | var buf: Payload.Pointer = undefined; |
| 275 | var buf: Payload.PointerSimple = undefined; |
| 267 | 276 | std.hash.autoHash(&hasher, self.optionalChild(&buf).hash()); |
| 268 | 277 | }, |
| 269 | 278 | .Float, |
| ... | ... | @@ -374,9 +383,13 @@ pub const Type = extern union { |
| 374 | 383 | .optional => return self.copyPayloadSingleField(allocator, Payload.Optional, "child_type"), |
| 375 | 384 | .single_const_pointer, |
| 376 | 385 | .single_mut_pointer, |
| 386 | .many_const_pointer, |
| 387 | .many_mut_pointer, |
| 388 | .c_const_pointer, |
| 389 | .c_mut_pointer, |
| 377 | 390 | .optional_single_mut_pointer, |
| 378 | 391 | .optional_single_const_pointer, |
| 379 | | => return self.copyPayloadSingleField(allocator, Payload.Pointer, "pointee_type"), |
| 392 | => return self.copyPayloadSingleField(allocator, Payload.PointerSimple, "pointee_type"), |
| 380 | 393 | } |
| 381 | 394 | } |
| 382 | 395 | |
| ... | ... | @@ -482,17 +495,41 @@ pub const Type = extern union { |
| 482 | 495 | continue; |
| 483 | 496 | }, |
| 484 | 497 | .single_const_pointer => { |
| 485 | | const payload = @fieldParentPtr(Payload.Pointer, "base", ty.ptr_otherwise); |
| 498 | const payload = @fieldParentPtr(Payload.PointerSimple, "base", ty.ptr_otherwise); |
| 486 | 499 | try out_stream.writeAll("*const "); |
| 487 | 500 | ty = payload.pointee_type; |
| 488 | 501 | continue; |
| 489 | 502 | }, |
| 490 | 503 | .single_mut_pointer => { |
| 491 | | const payload = @fieldParentPtr(Payload.Pointer, "base", ty.ptr_otherwise); |
| 504 | const payload = @fieldParentPtr(Payload.PointerSimple, "base", ty.ptr_otherwise); |
| 492 | 505 | try out_stream.writeAll("*"); |
| 493 | 506 | ty = payload.pointee_type; |
| 494 | 507 | continue; |
| 495 | 508 | }, |
| 509 | .many_const_pointer => { |
| 510 | const payload = @fieldParentPtr(Payload.PointerSimple, "base", ty.ptr_otherwise); |
| 511 | try out_stream.writeAll("[*]const "); |
| 512 | ty = payload.pointee_type; |
| 513 | continue; |
| 514 | }, |
| 515 | .many_mut_pointer => { |
| 516 | const payload = @fieldParentPtr(Payload.PointerSimple, "base", ty.ptr_otherwise); |
| 517 | try out_stream.writeAll("[*]"); |
| 518 | ty = payload.pointee_type; |
| 519 | continue; |
| 520 | }, |
| 521 | .c_const_pointer => { |
| 522 | const payload = @fieldParentPtr(Payload.PointerSimple, "base", ty.ptr_otherwise); |
| 523 | try out_stream.writeAll("[*c]const "); |
| 524 | ty = payload.pointee_type; |
| 525 | continue; |
| 526 | }, |
| 527 | .c_mut_pointer => { |
| 528 | const payload = @fieldParentPtr(Payload.PointerSimple, "base", ty.ptr_otherwise); |
| 529 | try out_stream.writeAll("[*c]"); |
| 530 | ty = payload.pointee_type; |
| 531 | continue; |
| 532 | }, |
| 496 | 533 | .int_signed => { |
| 497 | 534 | const payload = @fieldParentPtr(Payload.IntSigned, "base", ty.ptr_otherwise); |
| 498 | 535 | return out_stream.print("i{}", .{payload.bits}); |
| ... | ... | @@ -508,13 +545,13 @@ pub const Type = extern union { |
| 508 | 545 | continue; |
| 509 | 546 | }, |
| 510 | 547 | .optional_single_const_pointer => { |
| 511 | | const payload = @fieldParentPtr(Payload.Pointer, "base", ty.ptr_otherwise); |
| 548 | const payload = @fieldParentPtr(Payload.PointerSimple, "base", ty.ptr_otherwise); |
| 512 | 549 | try out_stream.writeAll("?*const "); |
| 513 | 550 | ty = payload.pointee_type; |
| 514 | 551 | continue; |
| 515 | 552 | }, |
| 516 | 553 | .optional_single_mut_pointer => { |
| 517 | | const payload = @fieldParentPtr(Payload.Pointer, "base", ty.ptr_otherwise); |
| 554 | const payload = @fieldParentPtr(Payload.PointerSimple, "base", ty.ptr_otherwise); |
| 518 | 555 | try out_stream.writeAll("?*"); |
| 519 | 556 | ty = payload.pointee_type; |
| 520 | 557 | continue; |
| ... | ... | @@ -619,6 +656,10 @@ pub const Type = extern union { |
| 619 | 656 | .array_sentinel => self.elemType().hasCodeGenBits(), |
| 620 | 657 | .single_const_pointer => self.elemType().hasCodeGenBits(), |
| 621 | 658 | .single_mut_pointer => self.elemType().hasCodeGenBits(), |
| 659 | .many_const_pointer => self.elemType().hasCodeGenBits(), |
| 660 | .many_mut_pointer => self.elemType().hasCodeGenBits(), |
| 661 | .c_const_pointer => self.elemType().hasCodeGenBits(), |
| 662 | .c_mut_pointer => self.elemType().hasCodeGenBits(), |
| 622 | 663 | .int_signed => self.cast(Payload.IntSigned).?.bits == 0, |
| 623 | 664 | .int_unsigned => self.cast(Payload.IntUnsigned).?.bits == 0, |
| 624 | 665 | |
| ... | ... | @@ -669,6 +710,10 @@ pub const Type = extern union { |
| 669 | 710 | .const_slice_u8, |
| 670 | 711 | .single_const_pointer, |
| 671 | 712 | .single_mut_pointer, |
| 713 | .many_const_pointer, |
| 714 | .many_mut_pointer, |
| 715 | .c_const_pointer, |
| 716 | .c_mut_pointer, |
| 672 | 717 | .optional_single_const_pointer, |
| 673 | 718 | .optional_single_mut_pointer, |
| 674 | 719 | => return @divExact(target.cpu.arch.ptrBitWidth(), 8), |
| ... | ... | @@ -704,7 +749,7 @@ pub const Type = extern union { |
| 704 | 749 | }, |
| 705 | 750 | |
| 706 | 751 | .optional => { |
| 707 | | var buf: Payload.Pointer = undefined; |
| 752 | var buf: Payload.PointerSimple = undefined; |
| 708 | 753 | const child_type = self.optionalChild(&buf); |
| 709 | 754 | if (!child_type.hasCodeGenBits()) return 1; |
| 710 | 755 | |
| ... | ... | @@ -772,6 +817,10 @@ pub const Type = extern union { |
| 772 | 817 | .const_slice_u8, |
| 773 | 818 | .single_const_pointer, |
| 774 | 819 | .single_mut_pointer, |
| 820 | .many_const_pointer, |
| 821 | .many_mut_pointer, |
| 822 | .c_const_pointer, |
| 823 | .c_mut_pointer, |
| 775 | 824 | .optional_single_const_pointer, |
| 776 | 825 | .optional_single_mut_pointer, |
| 777 | 826 | => return @divExact(target.cpu.arch.ptrBitWidth(), 8), |
| ... | ... | @@ -805,7 +854,7 @@ pub const Type = extern union { |
| 805 | 854 | }, |
| 806 | 855 | |
| 807 | 856 | .optional => { |
| 808 | | var buf: Payload.Pointer = undefined; |
| 857 | var buf: Payload.PointerSimple = undefined; |
| 809 | 858 | const child_type = self.optionalChild(&buf); |
| 810 | 859 | if (!child_type.hasCodeGenBits()) return 1; |
| 811 | 860 | |
| ... | ... | @@ -872,6 +921,10 @@ pub const Type = extern union { |
| 872 | 921 | .optional_single_mut_pointer, |
| 873 | 922 | .optional_single_const_pointer, |
| 874 | 923 | .enum_literal, |
| 924 | .many_const_pointer, |
| 925 | .many_mut_pointer, |
| 926 | .c_const_pointer, |
| 927 | .c_mut_pointer, |
| 875 | 928 | => false, |
| 876 | 929 | |
| 877 | 930 | .single_const_pointer, |
| ... | ... | @@ -922,6 +975,10 @@ pub const Type = extern union { |
| 922 | 975 | .array_u8_sentinel_0, |
| 923 | 976 | .single_const_pointer, |
| 924 | 977 | .single_mut_pointer, |
| 978 | .many_const_pointer, |
| 979 | .many_mut_pointer, |
| 980 | .c_const_pointer, |
| 981 | .c_mut_pointer, |
| 925 | 982 | .single_const_pointer_to_comptime_int, |
| 926 | 983 | .fn_noreturn_no_args, |
| 927 | 984 | .fn_void_no_args, |
| ... | ... | @@ -987,6 +1044,8 @@ pub const Type = extern union { |
| 987 | 1044 | .int_unsigned, |
| 988 | 1045 | .int_signed, |
| 989 | 1046 | .single_mut_pointer, |
| 1047 | .many_mut_pointer, |
| 1048 | .c_mut_pointer, |
| 990 | 1049 | .optional, |
| 991 | 1050 | .optional_single_mut_pointer, |
| 992 | 1051 | .optional_single_const_pointer, |
| ... | ... | @@ -994,6 +1053,8 @@ pub const Type = extern union { |
| 994 | 1053 | => false, |
| 995 | 1054 | |
| 996 | 1055 | .single_const_pointer, |
| 1056 | .many_const_pointer, |
| 1057 | .c_const_pointer, |
| 997 | 1058 | .single_const_pointer_to_comptime_int, |
| 998 | 1059 | .const_slice_u8, |
| 999 | 1060 | => true, |
| ... | ... | @@ -1048,6 +1109,10 @@ pub const Type = extern union { |
| 1048 | 1109 | .int_signed, |
| 1049 | 1110 | .single_mut_pointer, |
| 1050 | 1111 | .single_const_pointer, |
| 1112 | .many_const_pointer, |
| 1113 | .many_mut_pointer, |
| 1114 | .c_const_pointer, |
| 1115 | .c_mut_pointer, |
| 1051 | 1116 | .single_const_pointer_to_comptime_int, |
| 1052 | 1117 | .const_slice_u8, |
| 1053 | 1118 | .optional, |
| ... | ... | @@ -1063,7 +1128,7 @@ pub const Type = extern union { |
| 1063 | 1128 | switch (self.tag()) { |
| 1064 | 1129 | .optional_single_const_pointer, .optional_single_mut_pointer => return true, |
| 1065 | 1130 | .optional => { |
| 1066 | | var buf: Payload.Pointer = undefined; |
| 1131 | var buf: Payload.PointerSimple = undefined; |
| 1067 | 1132 | const child_type = self.optionalChild(&buf); |
| 1068 | 1133 | // optionals of zero sized pointers behave like bools |
| 1069 | 1134 | if (!child_type.hasCodeGenBits()) return false; |
| ... | ... | @@ -1101,7 +1166,7 @@ pub const Type = extern union { |
| 1101 | 1166 | => return false, |
| 1102 | 1167 | |
| 1103 | 1168 | .Optional => { |
| 1104 | | var buf: Payload.Pointer = undefined; |
| 1169 | var buf: Payload.PointerSimple = undefined; |
| 1105 | 1170 | return ty.optionalChild(&buf).isValidVarType(is_extern); |
| 1106 | 1171 | }, |
| 1107 | 1172 | .Pointer, .Array => ty = ty.elemType(), |
| ... | ... | @@ -1166,13 +1231,17 @@ pub const Type = extern union { |
| 1166 | 1231 | .array_sentinel => self.cast(Payload.ArraySentinel).?.elem_type, |
| 1167 | 1232 | .single_const_pointer => self.castPointer().?.pointee_type, |
| 1168 | 1233 | .single_mut_pointer => self.castPointer().?.pointee_type, |
| 1234 | .many_const_pointer => self.castPointer().?.pointee_type, |
| 1235 | .many_mut_pointer => self.castPointer().?.pointee_type, |
| 1236 | .c_const_pointer => self.castPointer().?.pointee_type, |
| 1237 | .c_mut_pointer => self.castPointer().?.pointee_type, |
| 1169 | 1238 | .array_u8, .array_u8_sentinel_0, .const_slice_u8 => Type.initTag(.u8), |
| 1170 | 1239 | .single_const_pointer_to_comptime_int => Type.initTag(.comptime_int), |
| 1171 | 1240 | }; |
| 1172 | 1241 | } |
| 1173 | 1242 | |
| 1174 | 1243 | /// Asserts that the type is an optional. |
| 1175 | | pub fn optionalChild(self: Type, buf: *Payload.Pointer) Type { |
| 1244 | pub fn optionalChild(self: Type, buf: *Payload.PointerSimple) Type { |
| 1176 | 1245 | return switch (self.tag()) { |
| 1177 | 1246 | .optional => self.cast(Payload.Optional).?.child_type, |
| 1178 | 1247 | .optional_single_mut_pointer => { |
| ... | ... | @@ -1199,7 +1268,7 @@ pub const Type = extern union { |
| 1199 | 1268 | return switch (self.tag()) { |
| 1200 | 1269 | .optional => self.cast(Payload.Optional).?.child_type, |
| 1201 | 1270 | .optional_single_mut_pointer, .optional_single_const_pointer => { |
| 1202 | | const payload = try allocator.create(Payload.Pointer); |
| 1271 | const payload = try allocator.create(Payload.PointerSimple); |
| 1203 | 1272 | payload.* = .{ |
| 1204 | 1273 | .base = .{ |
| 1205 | 1274 | .tag = if (self.tag() == .optional_single_const_pointer) |
| ... | ... | @@ -1258,6 +1327,10 @@ pub const Type = extern union { |
| 1258 | 1327 | .function, |
| 1259 | 1328 | .single_const_pointer, |
| 1260 | 1329 | .single_mut_pointer, |
| 1330 | .many_const_pointer, |
| 1331 | .many_mut_pointer, |
| 1332 | .c_const_pointer, |
| 1333 | .c_mut_pointer, |
| 1261 | 1334 | .single_const_pointer_to_comptime_int, |
| 1262 | 1335 | .const_slice_u8, |
| 1263 | 1336 | .int_unsigned, |
| ... | ... | @@ -1318,6 +1391,10 @@ pub const Type = extern union { |
| 1318 | 1391 | .function, |
| 1319 | 1392 | .single_const_pointer, |
| 1320 | 1393 | .single_mut_pointer, |
| 1394 | .many_const_pointer, |
| 1395 | .many_mut_pointer, |
| 1396 | .c_const_pointer, |
| 1397 | .c_mut_pointer, |
| 1321 | 1398 | .single_const_pointer_to_comptime_int, |
| 1322 | 1399 | .const_slice_u8, |
| 1323 | 1400 | .int_unsigned, |
| ... | ... | @@ -1368,6 +1445,10 @@ pub const Type = extern union { |
| 1368 | 1445 | .array_u8_sentinel_0, |
| 1369 | 1446 | .single_const_pointer, |
| 1370 | 1447 | .single_mut_pointer, |
| 1448 | .many_const_pointer, |
| 1449 | .many_mut_pointer, |
| 1450 | .c_const_pointer, |
| 1451 | .c_mut_pointer, |
| 1371 | 1452 | .single_const_pointer_to_comptime_int, |
| 1372 | 1453 | .const_slice_u8, |
| 1373 | 1454 | .int_unsigned, |
| ... | ... | @@ -1429,6 +1510,10 @@ pub const Type = extern union { |
| 1429 | 1510 | .array_u8_sentinel_0, |
| 1430 | 1511 | .single_const_pointer, |
| 1431 | 1512 | .single_mut_pointer, |
| 1513 | .many_const_pointer, |
| 1514 | .many_mut_pointer, |
| 1515 | .c_const_pointer, |
| 1516 | .c_mut_pointer, |
| 1432 | 1517 | .single_const_pointer_to_comptime_int, |
| 1433 | 1518 | .const_slice_u8, |
| 1434 | 1519 | .int_signed, |
| ... | ... | @@ -1490,6 +1575,10 @@ pub const Type = extern union { |
| 1490 | 1575 | .array_u8_sentinel_0, |
| 1491 | 1576 | .single_const_pointer, |
| 1492 | 1577 | .single_mut_pointer, |
| 1578 | .many_const_pointer, |
| 1579 | .many_mut_pointer, |
| 1580 | .c_const_pointer, |
| 1581 | .c_mut_pointer, |
| 1493 | 1582 | .single_const_pointer_to_comptime_int, |
| 1494 | 1583 | .const_slice_u8, |
| 1495 | 1584 | .optional, |
| ... | ... | @@ -1549,6 +1638,10 @@ pub const Type = extern union { |
| 1549 | 1638 | .array_u8_sentinel_0, |
| 1550 | 1639 | .single_const_pointer, |
| 1551 | 1640 | .single_mut_pointer, |
| 1641 | .many_const_pointer, |
| 1642 | .many_mut_pointer, |
| 1643 | .c_const_pointer, |
| 1644 | .c_mut_pointer, |
| 1552 | 1645 | .single_const_pointer_to_comptime_int, |
| 1553 | 1646 | .const_slice_u8, |
| 1554 | 1647 | .int_unsigned, |
| ... | ... | @@ -1637,6 +1730,10 @@ pub const Type = extern union { |
| 1637 | 1730 | .array_u8_sentinel_0, |
| 1638 | 1731 | .single_const_pointer, |
| 1639 | 1732 | .single_mut_pointer, |
| 1733 | .many_const_pointer, |
| 1734 | .many_mut_pointer, |
| 1735 | .c_const_pointer, |
| 1736 | .c_mut_pointer, |
| 1640 | 1737 | .single_const_pointer_to_comptime_int, |
| 1641 | 1738 | .const_slice_u8, |
| 1642 | 1739 | .u8, |
| ... | ... | @@ -1701,6 +1798,10 @@ pub const Type = extern union { |
| 1701 | 1798 | .array_u8_sentinel_0, |
| 1702 | 1799 | .single_const_pointer, |
| 1703 | 1800 | .single_mut_pointer, |
| 1801 | .many_const_pointer, |
| 1802 | .many_mut_pointer, |
| 1803 | .c_const_pointer, |
| 1804 | .c_mut_pointer, |
| 1704 | 1805 | .single_const_pointer_to_comptime_int, |
| 1705 | 1806 | .const_slice_u8, |
| 1706 | 1807 | .u8, |
| ... | ... | @@ -1764,6 +1865,10 @@ pub const Type = extern union { |
| 1764 | 1865 | .array_u8_sentinel_0, |
| 1765 | 1866 | .single_const_pointer, |
| 1766 | 1867 | .single_mut_pointer, |
| 1868 | .many_const_pointer, |
| 1869 | .many_mut_pointer, |
| 1870 | .c_const_pointer, |
| 1871 | .c_mut_pointer, |
| 1767 | 1872 | .single_const_pointer_to_comptime_int, |
| 1768 | 1873 | .const_slice_u8, |
| 1769 | 1874 | .u8, |
| ... | ... | @@ -1827,6 +1932,10 @@ pub const Type = extern union { |
| 1827 | 1932 | .array_u8_sentinel_0, |
| 1828 | 1933 | .single_const_pointer, |
| 1829 | 1934 | .single_mut_pointer, |
| 1935 | .many_const_pointer, |
| 1936 | .many_mut_pointer, |
| 1937 | .c_const_pointer, |
| 1938 | .c_mut_pointer, |
| 1830 | 1939 | .single_const_pointer_to_comptime_int, |
| 1831 | 1940 | .const_slice_u8, |
| 1832 | 1941 | .u8, |
| ... | ... | @@ -1887,6 +1996,10 @@ pub const Type = extern union { |
| 1887 | 1996 | .array_u8_sentinel_0, |
| 1888 | 1997 | .single_const_pointer, |
| 1889 | 1998 | .single_mut_pointer, |
| 1999 | .many_const_pointer, |
| 2000 | .many_mut_pointer, |
| 2001 | .c_const_pointer, |
| 2002 | .c_mut_pointer, |
| 1890 | 2003 | .single_const_pointer_to_comptime_int, |
| 1891 | 2004 | .const_slice_u8, |
| 1892 | 2005 | .u8, |
| ... | ... | @@ -1947,6 +2060,10 @@ pub const Type = extern union { |
| 1947 | 2060 | .array_u8_sentinel_0, |
| 1948 | 2061 | .single_const_pointer, |
| 1949 | 2062 | .single_mut_pointer, |
| 2063 | .many_const_pointer, |
| 2064 | .many_mut_pointer, |
| 2065 | .c_const_pointer, |
| 2066 | .c_mut_pointer, |
| 1950 | 2067 | .single_const_pointer_to_comptime_int, |
| 1951 | 2068 | .const_slice_u8, |
| 1952 | 2069 | .u8, |
| ... | ... | @@ -2027,6 +2144,10 @@ pub const Type = extern union { |
| 2027 | 2144 | .array_u8_sentinel_0, |
| 2028 | 2145 | .single_const_pointer, |
| 2029 | 2146 | .single_mut_pointer, |
| 2147 | .many_const_pointer, |
| 2148 | .many_mut_pointer, |
| 2149 | .c_const_pointer, |
| 2150 | .c_mut_pointer, |
| 2030 | 2151 | .single_const_pointer_to_comptime_int, |
| 2031 | 2152 | .const_slice_u8, |
| 2032 | 2153 | .optional, |
| ... | ... | @@ -2109,7 +2230,13 @@ pub const Type = extern union { |
| 2109 | 2230 | ty = ty.elemType(); |
| 2110 | 2231 | continue; |
| 2111 | 2232 | }, |
| 2112 | | .single_const_pointer, .single_mut_pointer => { |
| 2233 | .many_const_pointer, |
| 2234 | .many_mut_pointer, |
| 2235 | .c_const_pointer, |
| 2236 | .c_mut_pointer, |
| 2237 | .single_const_pointer, |
| 2238 | .single_mut_pointer, |
| 2239 | => { |
| 2113 | 2240 | const ptr = ty.castPointer().?; |
| 2114 | 2241 | ty = ptr.pointee_type; |
| 2115 | 2242 | continue; |
| ... | ... | @@ -2167,11 +2294,17 @@ pub const Type = extern union { |
| 2167 | 2294 | .array_u8_sentinel_0, |
| 2168 | 2295 | .single_const_pointer, |
| 2169 | 2296 | .single_mut_pointer, |
| 2297 | .many_const_pointer, |
| 2298 | .many_mut_pointer, |
| 2170 | 2299 | .optional, |
| 2171 | 2300 | .optional_single_mut_pointer, |
| 2172 | 2301 | .optional_single_const_pointer, |
| 2173 | 2302 | .enum_literal, |
| 2174 | 2303 | => return false, |
| 2304 | |
| 2305 | .c_const_pointer, |
| 2306 | .c_mut_pointer, |
| 2307 | => return true, |
| 2175 | 2308 | }; |
| 2176 | 2309 | } |
| 2177 | 2310 | |
| ... | ... | @@ -2231,6 +2364,10 @@ pub const Type = extern union { |
| 2231 | 2364 | array_sentinel, |
| 2232 | 2365 | single_const_pointer, |
| 2233 | 2366 | single_mut_pointer, |
| 2367 | many_const_pointer, |
| 2368 | many_mut_pointer, |
| 2369 | c_const_pointer, |
| 2370 | c_mut_pointer, |
| 2234 | 2371 | int_signed, |
| 2235 | 2372 | int_unsigned, |
| 2236 | 2373 | function, |
| ... | ... | @@ -2272,7 +2409,7 @@ pub const Type = extern union { |
| 2272 | 2409 | elem_type: Type, |
| 2273 | 2410 | }; |
| 2274 | 2411 | |
| 2275 | | pub const Pointer = struct { |
| 2412 | pub const PointerSimple = struct { |
| 2276 | 2413 | base: Payload, |
| 2277 | 2414 | |
| 2278 | 2415 | pointee_type: Type, |