authorgravatar for codroid@gmail.comStevie Hryciw <codroid@gmail.com> 2022-11-14 20:44:31-08:00
committergravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2022-11-18 19:22:42+00:00
log04f3067a7921a51bd55870f3138220fd66426e33
tree158494e96381fe48304fef102d36a9431eef9642
parente999f9f472f6b57214a8a66b69b8928ad28acbfe

run zig fmt on everything checked by CI


40 files changed, 292 insertions(+), 293 deletions(-)

lib/std/c/freebsd.zig+4-4
...@@ -261,7 +261,7 @@ pub const Flock = extern struct {...@@ -261,7 +261,7 @@ pub const Flock = extern struct {
261 /// Lock owner.261 /// Lock owner.
262 pid: pid_t,262 pid: pid_t,
263 /// Lock type.263 /// Lock type.
264 @"type": i16,264 type: i16,
265 /// Type of the start member.265 /// Type of the start member.
266 whence: i16,266 whence: i16,
267 /// Remote system id or zero for local.267 /// Remote system id or zero for local.
...@@ -438,7 +438,7 @@ pub const kinfo_file = extern struct {...@@ -438,7 +438,7 @@ pub const kinfo_file = extern struct {
438 /// A zero value is for the sentinel record at the end of an array.438 /// A zero value is for the sentinel record at the end of an array.
439 structsize: c_int,439 structsize: c_int,
440 /// Descriptor type.440 /// Descriptor type.
441 @"type": c_int,441 type: c_int,
442 /// Array index.442 /// Array index.
443 fd: fd_t,443 fd: fd_t,
444 /// Reference count.444 /// Reference count.
...@@ -456,7 +456,7 @@ pub const kinfo_file = extern struct {...@@ -456,7 +456,7 @@ pub const kinfo_file = extern struct {
456 /// Socket domain.456 /// Socket domain.
457 domain: c_int,457 domain: c_int,
458 /// Socket type.458 /// Socket type.
459 @"type": c_int,459 type: c_int,
460 /// Socket protocol.460 /// Socket protocol.
461 protocol: c_int,461 protocol: c_int,
462 /// Socket address.462 /// Socket address.
...@@ -478,7 +478,7 @@ pub const kinfo_file = extern struct {...@@ -478,7 +478,7 @@ pub const kinfo_file = extern struct {
478 },478 },
479 file: extern struct {479 file: extern struct {
480 /// Vnode type.480 /// Vnode type.
481 @"type": i32,481 type: i32,
482 // Reserved for future use482 // Reserved for future use
483 _spare1: [3]i32,483 _spare1: [3]i32,
484 _spare2: [30]u64,484 _spare2: [30]u64,
lib/std/c/solaris.zig+6-6
...@@ -24,20 +24,20 @@ pub const pthread_mutex_t = extern struct {...@@ -24,20 +24,20 @@ pub const pthread_mutex_t = extern struct {
24 flag1: u16 = 0,24 flag1: u16 = 0,
25 flag2: u8 = 0,25 flag2: u8 = 0,
26 ceiling: u8 = 0,26 ceiling: u8 = 0,
27 @"type": u16 = 0,27 type: u16 = 0,
28 magic: u16 = 0x4d58,28 magic: u16 = 0x4d58,
29 lock: u64 = 0,29 lock: u64 = 0,
30 data: u64 = 0,30 data: u64 = 0,
31};31};
32pub const pthread_cond_t = extern struct {32pub const pthread_cond_t = extern struct {
33 flag: [4]u8 = [_]u8{0} ** 4,33 flag: [4]u8 = [_]u8{0} ** 4,
34 @"type": u16 = 0,34 type: u16 = 0,
35 magic: u16 = 0x4356,35 magic: u16 = 0x4356,
36 data: u64 = 0,36 data: u64 = 0,
37};37};
38pub const pthread_rwlock_t = extern struct {38pub const pthread_rwlock_t = extern struct {
39 readers: i32 = 0,39 readers: i32 = 0,
40 @"type": u16 = 0,40 type: u16 = 0,
41 magic: u16 = 0x5257,41 magic: u16 = 0x5257,
42 mutex: pthread_mutex_t = .{},42 mutex: pthread_mutex_t = .{},
43 readercv: pthread_cond_t = .{},43 readercv: pthread_cond_t = .{},
...@@ -50,7 +50,7 @@ pub const pthread_key_t = c_int;...@@ -50,7 +50,7 @@ pub const pthread_key_t = c_int;
5050
51pub const sem_t = extern struct {51pub const sem_t = extern struct {
52 count: u32 = 0,52 count: u32 = 0,
53 @"type": u16 = 0,53 type: u16 = 0,
54 magic: u16 = 0x534d,54 magic: u16 = 0x534d,
55 __pad1: [3]u64 = [_]u64{0} ** 3,55 __pad1: [3]u64 = [_]u64{0} ** 3,
56 __pad2: [2]u64 = [_]u64{0} ** 2,56 __pad2: [2]u64 = [_]u64{0} ** 2,
...@@ -1683,7 +1683,7 @@ pub const _SC = struct {...@@ -1683,7 +1683,7 @@ pub const _SC = struct {
1683pub const procfs = struct {1683pub const procfs = struct {
1684 pub const misc_header = extern struct {1684 pub const misc_header = extern struct {
1685 size: u32,1685 size: u32,
1686 @"type": enum(u32) {1686 type: enum(u32) {
1687 Pathname,1687 Pathname,
1688 Socketname,1688 Socketname,
1689 Peersockname,1689 Peersockname,
...@@ -1851,7 +1851,7 @@ pub const lifreq = extern struct {...@@ -1851,7 +1851,7 @@ pub const lifreq = extern struct {
1851 ppa: u32,1851 ppa: u32,
1852 },1852 },
1853 /// One of the IFT types, e.g. IFT_ETHER.1853 /// One of the IFT types, e.g. IFT_ETHER.
1854 @"type": u32,1854 type: u32,
1855 ifru: extern union {1855 ifru: extern union {
1856 /// Address.1856 /// Address.
1857 addr: sockaddr.storage,1857 addr: sockaddr.storage,
lib/std/coff.zig+4-4
...@@ -324,7 +324,7 @@ pub const BaseRelocation = packed struct {...@@ -324,7 +324,7 @@ pub const BaseRelocation = packed struct {
324 offset: u12,324 offset: u12,
325325
326 /// Stored in the high 4 bits of the WORD, a value that indicates the type of base relocation to be applied.326 /// Stored in the high 4 bits of the WORD, a value that indicates the type of base relocation to be applied.
327 @"type": BaseRelocationType,327 type: BaseRelocationType,
328};328};
329329
330pub const BaseRelocationType = enum(u4) {330pub const BaseRelocationType = enum(u4) {
...@@ -393,7 +393,7 @@ pub const DebugDirectoryEntry = extern struct {...@@ -393,7 +393,7 @@ pub const DebugDirectoryEntry = extern struct {
393 time_date_stamp: u32,393 time_date_stamp: u32,
394 major_version: u16,394 major_version: u16,
395 minor_version: u16,395 minor_version: u16,
396 @"type": DebugType,396 type: DebugType,
397 size_of_data: u32,397 size_of_data: u32,
398 address_of_raw_data: u32,398 address_of_raw_data: u32,
399 pointer_to_raw_data: u32,399 pointer_to_raw_data: u32,
...@@ -650,7 +650,7 @@ pub const Symbol = struct {...@@ -650,7 +650,7 @@ pub const Symbol = struct {
650 name: [8]u8,650 name: [8]u8,
651 value: u32,651 value: u32,
652 section_number: SectionNumber,652 section_number: SectionNumber,
653 @"type": SymType,653 type: SymType,
654 storage_class: StorageClass,654 storage_class: StorageClass,
655 number_of_aux_symbols: u8,655 number_of_aux_symbols: u8,
656656
...@@ -1309,7 +1309,7 @@ pub const Symtab = struct {...@@ -1309,7 +1309,7 @@ pub const Symtab = struct {
1309 .name = raw[0..8].*,1309 .name = raw[0..8].*,
1310 .value = mem.readIntLittle(u32, raw[8..12]),1310 .value = mem.readIntLittle(u32, raw[8..12]),
1311 .section_number = @intToEnum(SectionNumber, mem.readIntLittle(u16, raw[12..14])),1311 .section_number = @intToEnum(SectionNumber, mem.readIntLittle(u16, raw[12..14])),
1312 .@"type" = @bitCast(SymType, mem.readIntLittle(u16, raw[14..16])),1312 .type = @bitCast(SymType, mem.readIntLittle(u16, raw[14..16])),
1313 .storage_class = @intToEnum(StorageClass, raw[16]),1313 .storage_class = @intToEnum(StorageClass, raw[16]),
1314 .number_of_aux_symbols = raw[17],1314 .number_of_aux_symbols = raw[17],
1315 };1315 };
lib/std/elf.zig+1-1
...@@ -835,7 +835,7 @@ pub const Elf32_RegInfo = extern struct {...@@ -835,7 +835,7 @@ pub const Elf32_RegInfo = extern struct {
835pub const Elf_Options = extern struct {835pub const Elf_Options = extern struct {
836 kind: u8,836 kind: u8,
837 size: u8,837 size: u8,
838 @"section": Elf32_Section,838 section: Elf32_Section,
839 info: Elf32_Word,839 info: Elf32_Word,
840};840};
841pub const Elf_Options_Hw = extern struct {841pub const Elf_Options_Hw = extern struct {
lib/std/fs/wasi.zig+7-7
...@@ -80,13 +80,13 @@ pub const Preopen = struct {...@@ -80,13 +80,13 @@ pub const Preopen = struct {
80 fd: fd_t,80 fd: fd_t,
8181
82 /// Type of the preopen.82 /// Type of the preopen.
83 @"type": PreopenType,83 type: PreopenType,
8484
85 /// Construct new `Preopen` instance.85 /// Construct new `Preopen` instance.
86 pub fn new(fd: fd_t, preopen_type: PreopenType) Preopen {86 pub fn new(fd: fd_t, preopen_type: PreopenType) Preopen {
87 return Preopen{87 return Preopen{
88 .fd = fd,88 .fd = fd,
89 .@"type" = preopen_type,89 .type = preopen_type,
90 };90 };
91 }91 }
92};92};
...@@ -125,7 +125,7 @@ pub const PreopenList = struct {...@@ -125,7 +125,7 @@ pub const PreopenList = struct {
125 /// Release all allocated memory.125 /// Release all allocated memory.
126 pub fn deinit(pm: Self) void {126 pub fn deinit(pm: Self) void {
127 for (pm.buffer.items) |preopen| {127 for (pm.buffer.items) |preopen| {
128 switch (preopen.@"type") {128 switch (preopen.type) {
129 PreopenType.Dir => |path| pm.buffer.allocator.free(path),129 PreopenType.Dir => |path| pm.buffer.allocator.free(path),
130 }130 }
131 }131 }
...@@ -161,7 +161,7 @@ pub const PreopenList = struct {...@@ -161,7 +161,7 @@ pub const PreopenList = struct {
161161
162 // Clear contents if we're being called again162 // Clear contents if we're being called again
163 for (self.toOwnedSlice()) |preopen| {163 for (self.toOwnedSlice()) |preopen| {
164 switch (preopen.@"type") {164 switch (preopen.type) {
165 PreopenType.Dir => |path| self.buffer.allocator.free(path),165 PreopenType.Dir => |path| self.buffer.allocator.free(path),
166 }166 }
167 }167 }
...@@ -226,7 +226,7 @@ pub const PreopenList = struct {...@@ -226,7 +226,7 @@ pub const PreopenList = struct {
226 var best_match: ?PreopenUri = null;226 var best_match: ?PreopenUri = null;
227227
228 for (self.buffer.items) |preopen| {228 for (self.buffer.items) |preopen| {
229 if (preopen.@"type".getRelativePath(preopen_type)) |rel_path| {229 if (preopen.type.getRelativePath(preopen_type)) |rel_path| {
230 if (best_match == null or rel_path.len <= best_match.?.relative_path.len) {230 if (best_match == null or rel_path.len <= best_match.?.relative_path.len) {
231 best_match = PreopenUri{231 best_match = PreopenUri{
232 .base = preopen,232 .base = preopen,
...@@ -253,7 +253,7 @@ pub const PreopenList = struct {...@@ -253,7 +253,7 @@ pub const PreopenList = struct {
253 /// Otherwise, return `null`.253 /// Otherwise, return `null`.
254 pub fn find(self: Self, preopen_type: PreopenType) ?*const Preopen {254 pub fn find(self: Self, preopen_type: PreopenType) ?*const Preopen {
255 for (self.buffer.items) |*preopen| {255 for (self.buffer.items) |*preopen| {
256 if (preopen.@"type".eql(preopen_type)) {256 if (preopen.type.eql(preopen_type)) {
257 return preopen;257 return preopen;
258 }258 }
259 }259 }
...@@ -280,7 +280,7 @@ test "extracting WASI preopens" {...@@ -280,7 +280,7 @@ test "extracting WASI preopens" {
280 try preopens.populate(null);280 try preopens.populate(null);
281281
282 const preopen = preopens.find(PreopenType{ .Dir = "." }) orelse unreachable;282 const preopen = preopens.find(PreopenType{ .Dir = "." }) orelse unreachable;
283 try std.testing.expect(preopen.@"type".eql(PreopenType{ .Dir = "." }));283 try std.testing.expect(preopen.type.eql(PreopenType{ .Dir = "." }));
284284
285 const po_type1 = PreopenType{ .Dir = "/" };285 const po_type1 = PreopenType{ .Dir = "/" };
286 try std.testing.expect(std.mem.eql(u8, po_type1.getRelativePath(.{ .Dir = "/" }).?, ""));286 try std.testing.expect(std.mem.eql(u8, po_type1.getRelativePath(.{ .Dir = "/" }).?, ""));
lib/std/macho.zig+4-4
...@@ -700,7 +700,7 @@ pub const PROT = struct {...@@ -700,7 +700,7 @@ pub const PROT = struct {
700/// The format of the relocation entries referenced by the reloff and nreloc700/// The format of the relocation entries referenced by the reloff and nreloc
701/// fields of the section structure for mach object files is described in the701/// fields of the section structure for mach object files is described in the
702/// header file <reloc.h>.702/// header file <reloc.h>.
703pub const @"section" = extern struct {703pub const section = extern struct {
704 /// name of this section704 /// name of this section
705 sectname: [16]u8,705 sectname: [16]u8,
706706
...@@ -794,12 +794,12 @@ pub const section_64 = extern struct {...@@ -794,12 +794,12 @@ pub const section_64 = extern struct {
794 }794 }
795795
796 pub fn isZerofill(sect: section_64) bool {796 pub fn isZerofill(sect: section_64) bool {
797 const tt = sect.@"type"();797 const tt = sect.type();
798 return tt == S_ZEROFILL or tt == S_GB_ZEROFILL or tt == S_THREAD_LOCAL_ZEROFILL;798 return tt == S_ZEROFILL or tt == S_GB_ZEROFILL or tt == S_THREAD_LOCAL_ZEROFILL;
799 }799 }
800800
801 pub fn isSymbolStubs(sect: section_64) bool {801 pub fn isSymbolStubs(sect: section_64) bool {
802 const tt = sect.@"type"();802 const tt = sect.type();
803 return tt == S_SYMBOL_STUBS;803 return tt == S_SYMBOL_STUBS;
804 }804 }
805805
...@@ -1804,7 +1804,7 @@ pub const CodeDirectory = extern struct {...@@ -1804,7 +1804,7 @@ pub const CodeDirectory = extern struct {
1804/// Structure of an embedded-signature SuperBlob1804/// Structure of an embedded-signature SuperBlob
1805pub const BlobIndex = extern struct {1805pub const BlobIndex = extern struct {
1806 /// Type of entry1806 /// Type of entry
1807 @"type": u32,1807 type: u32,
18081808
1809 /// Offset of entry1809 /// Offset of entry
1810 offset: u32,1810 offset: u32,
lib/std/os/linux.zig+5-5
...@@ -3310,8 +3310,8 @@ pub const mmsghdr_const = extern struct {...@@ -3310,8 +3310,8 @@ pub const mmsghdr_const = extern struct {
3310pub const epoll_data = extern union {3310pub const epoll_data = extern union {
3311 ptr: usize,3311 ptr: usize,
3312 fd: i32,3312 fd: i32,
3313 @"u32": u32,3313 u32: u32,
3314 @"u64": u64,3314 u64: u64,
3315};3315};
33163316
3317pub const epoll_event = switch (builtin.zig_backend) {3317pub const epoll_event = switch (builtin.zig_backend) {
...@@ -5124,7 +5124,7 @@ pub const nlmsghdr = extern struct {...@@ -5124,7 +5124,7 @@ pub const nlmsghdr = extern struct {
5124 len: u32,5124 len: u32,
51255125
5126 /// Message content5126 /// Message content
5127 @"type": NetlinkMessageType,5127 type: NetlinkMessageType,
51285128
5129 /// Additional flags5129 /// Additional flags
5130 flags: u16,5130 flags: u16,
...@@ -5141,7 +5141,7 @@ pub const ifinfomsg = extern struct {...@@ -5141,7 +5141,7 @@ pub const ifinfomsg = extern struct {
5141 __pad1: u8 = 0,5141 __pad1: u8 = 0,
51425142
5143 /// ARPHRD_*5143 /// ARPHRD_*
5144 @"type": c_ushort,5144 type: c_ushort,
51455145
5146 /// Link index5146 /// Link index
5147 index: c_int,5147 index: c_int,
...@@ -5158,7 +5158,7 @@ pub const rtattr = extern struct {...@@ -5158,7 +5158,7 @@ pub const rtattr = extern struct {
5158 len: c_ushort,5158 len: c_ushort,
51595159
5160 /// Type of option5160 /// Type of option
5161 @"type": IFLA,5161 type: IFLA,
51625162
5163 pub const ALIGNTO = 4;5163 pub const ALIGNTO = 4;
5164};5164};
lib/std/os/linux/sparc64.zig+1-1
...@@ -435,7 +435,7 @@ pub const fpu_t = extern struct {...@@ -435,7 +435,7 @@ pub const fpu_t = extern struct {
435pub const mcontext_t = extern struct {435pub const mcontext_t = extern struct {
436 gregs: gregset_t,436 gregs: gregset_t,
437 fp: greg_t,437 fp: greg_t,
438 @"i7": greg_t,438 i7: greg_t,
439 fpregs: fpu_t,439 fpregs: fpu_t,
440};440};
441441
lib/std/os/wasi.zig+1-1
...@@ -279,7 +279,7 @@ pub const E = errno_t;...@@ -279,7 +279,7 @@ pub const E = errno_t;
279pub const event_t = extern struct {279pub const event_t = extern struct {
280 userdata: userdata_t,280 userdata: userdata_t,
281 @"error": errno_t,281 @"error": errno_t,
282 @"type": eventtype_t,282 type: eventtype_t,
283 fd_readwrite: eventfdreadwrite_t,283 fd_readwrite: eventfdreadwrite_t,
284};284};
285285
lib/std/zig/system/linux.zig+11-11
...@@ -84,20 +84,20 @@ const PowerpcCpuinfoImpl = struct {...@@ -84,20 +84,20 @@ const PowerpcCpuinfoImpl = struct {
84 .{ "7410", &Target.powerpc.cpu.@"7400" },84 .{ "7410", &Target.powerpc.cpu.@"7400" },
85 .{ "7447", &Target.powerpc.cpu.@"7400" },85 .{ "7447", &Target.powerpc.cpu.@"7400" },
86 .{ "7455", &Target.powerpc.cpu.@"7450" },86 .{ "7455", &Target.powerpc.cpu.@"7450" },
87 .{ "G4", &Target.powerpc.cpu.@"g4" },87 .{ "G4", &Target.powerpc.cpu.g4 },
88 .{ "POWER4", &Target.powerpc.cpu.@"970" },88 .{ "POWER4", &Target.powerpc.cpu.@"970" },
89 .{ "PPC970FX", &Target.powerpc.cpu.@"970" },89 .{ "PPC970FX", &Target.powerpc.cpu.@"970" },
90 .{ "PPC970MP", &Target.powerpc.cpu.@"970" },90 .{ "PPC970MP", &Target.powerpc.cpu.@"970" },
91 .{ "G5", &Target.powerpc.cpu.@"g5" },91 .{ "G5", &Target.powerpc.cpu.g5 },
92 .{ "POWER5", &Target.powerpc.cpu.@"g5" },92 .{ "POWER5", &Target.powerpc.cpu.g5 },
93 .{ "A2", &Target.powerpc.cpu.@"a2" },93 .{ "A2", &Target.powerpc.cpu.a2 },
94 .{ "POWER6", &Target.powerpc.cpu.@"pwr6" },94 .{ "POWER6", &Target.powerpc.cpu.pwr6 },
95 .{ "POWER7", &Target.powerpc.cpu.@"pwr7" },95 .{ "POWER7", &Target.powerpc.cpu.pwr7 },
96 .{ "POWER8", &Target.powerpc.cpu.@"pwr8" },96 .{ "POWER8", &Target.powerpc.cpu.pwr8 },
97 .{ "POWER8E", &Target.powerpc.cpu.@"pwr8" },97 .{ "POWER8E", &Target.powerpc.cpu.pwr8 },
98 .{ "POWER8NVL", &Target.powerpc.cpu.@"pwr8" },98 .{ "POWER8NVL", &Target.powerpc.cpu.pwr8 },
99 .{ "POWER9", &Target.powerpc.cpu.@"pwr9" },99 .{ "POWER9", &Target.powerpc.cpu.pwr9 },
100 .{ "POWER10", &Target.powerpc.cpu.@"pwr10" },100 .{ "POWER10", &Target.powerpc.cpu.pwr10 },
101 };101 };
102102
103 fn line_hook(self: *PowerpcCpuinfoImpl, key: []const u8, value: []const u8) !bool {103 fn line_hook(self: *PowerpcCpuinfoImpl, key: []const u8, value: []const u8) !bool {
src/AstGen.zig+20-20
...@@ -2868,7 +2868,7 @@ fn deferStmt(...@@ -2868,7 +2868,7 @@ fn deferStmt(
2868 .name = ident_name,2868 .name = ident_name,
2869 .inst = remapped_err_code_ref,2869 .inst = remapped_err_code_ref,
2870 .token_src = payload_token,2870 .token_src = payload_token,
2871 .id_cat = .@"capture",2871 .id_cat = .capture,
2872 };2872 };
2873 try gz.addDbgVar(.dbg_var_val, ident_name, remapped_err_code_ref);2873 try gz.addDbgVar(.dbg_var_val, ident_name, remapped_err_code_ref);
2874 break :blk &local_val_scope.base;2874 break :blk &local_val_scope.base;
...@@ -5353,7 +5353,7 @@ fn orelseCatchExpr(...@@ -5353,7 +5353,7 @@ fn orelseCatchExpr(
5353 }5353 }
5354 const err_name = try astgen.identAsString(payload);5354 const err_name = try astgen.identAsString(payload);
53555355
5356 try astgen.detectLocalShadowing(scope, err_name, payload, err_str, .@"capture");5356 try astgen.detectLocalShadowing(scope, err_name, payload, err_str, .capture);
53575357
5358 err_val_scope = .{5358 err_val_scope = .{
5359 .parent = &else_scope.base,5359 .parent = &else_scope.base,
...@@ -5361,7 +5361,7 @@ fn orelseCatchExpr(...@@ -5361,7 +5361,7 @@ fn orelseCatchExpr(
5361 .name = err_name,5361 .name = err_name,
5362 .inst = try else_scope.addUnNode(unwrap_code_op, operand, node),5362 .inst = try else_scope.addUnNode(unwrap_code_op, operand, node),
5363 .token_src = payload,5363 .token_src = payload,
5364 .id_cat = .@"capture",5364 .id_cat = .capture,
5365 };5365 };
5366 break :blk &err_val_scope.base;5366 break :blk &err_val_scope.base;
5367 };5367 };
...@@ -5698,14 +5698,14 @@ fn ifExpr(...@@ -5698,14 +5698,14 @@ fn ifExpr(
5698 const token_name_str = tree.tokenSlice(token_name_index);5698 const token_name_str = tree.tokenSlice(token_name_index);
5699 if (mem.eql(u8, "_", token_name_str))5699 if (mem.eql(u8, "_", token_name_str))
5700 break :s &then_scope.base;5700 break :s &then_scope.base;
5701 try astgen.detectLocalShadowing(&then_scope.base, ident_name, token_name_index, token_name_str, .@"capture");5701 try astgen.detectLocalShadowing(&then_scope.base, ident_name, token_name_index, token_name_str, .capture);
5702 payload_val_scope = .{5702 payload_val_scope = .{
5703 .parent = &then_scope.base,5703 .parent = &then_scope.base,
5704 .gen_zir = &then_scope,5704 .gen_zir = &then_scope,
5705 .name = ident_name,5705 .name = ident_name,
5706 .inst = payload_inst,5706 .inst = payload_inst,
5707 .token_src = payload_token,5707 .token_src = payload_token,
5708 .id_cat = .@"capture",5708 .id_cat = .capture,
5709 };5709 };
5710 try then_scope.addDbgVar(.dbg_var_val, ident_name, payload_inst);5710 try then_scope.addDbgVar(.dbg_var_val, ident_name, payload_inst);
5711 break :s &payload_val_scope.base;5711 break :s &payload_val_scope.base;
...@@ -5724,14 +5724,14 @@ fn ifExpr(...@@ -5724,14 +5724,14 @@ fn ifExpr(
5724 break :s &then_scope.base;5724 break :s &then_scope.base;
5725 const payload_inst = try then_scope.addUnNode(tag, cond.inst, if_full.ast.then_expr);5725 const payload_inst = try then_scope.addUnNode(tag, cond.inst, if_full.ast.then_expr);
5726 const ident_name = try astgen.identAsString(ident_token);5726 const ident_name = try astgen.identAsString(ident_token);
5727 try astgen.detectLocalShadowing(&then_scope.base, ident_name, ident_token, ident_bytes, .@"capture");5727 try astgen.detectLocalShadowing(&then_scope.base, ident_name, ident_token, ident_bytes, .capture);
5728 payload_val_scope = .{5728 payload_val_scope = .{
5729 .parent = &then_scope.base,5729 .parent = &then_scope.base,
5730 .gen_zir = &then_scope,5730 .gen_zir = &then_scope,
5731 .name = ident_name,5731 .name = ident_name,
5732 .inst = payload_inst,5732 .inst = payload_inst,
5733 .token_src = ident_token,5733 .token_src = ident_token,
5734 .id_cat = .@"capture",5734 .id_cat = .capture,
5735 };5735 };
5736 try then_scope.addDbgVar(.dbg_var_val, ident_name, payload_inst);5736 try then_scope.addDbgVar(.dbg_var_val, ident_name, payload_inst);
5737 break :s &payload_val_scope.base;5737 break :s &payload_val_scope.base;
...@@ -5775,14 +5775,14 @@ fn ifExpr(...@@ -5775,14 +5775,14 @@ fn ifExpr(
5775 const error_token_str = tree.tokenSlice(error_token);5775 const error_token_str = tree.tokenSlice(error_token);
5776 if (mem.eql(u8, "_", error_token_str))5776 if (mem.eql(u8, "_", error_token_str))
5777 break :s &else_scope.base;5777 break :s &else_scope.base;
5778 try astgen.detectLocalShadowing(&else_scope.base, ident_name, error_token, error_token_str, .@"capture");5778 try astgen.detectLocalShadowing(&else_scope.base, ident_name, error_token, error_token_str, .capture);
5779 payload_val_scope = .{5779 payload_val_scope = .{
5780 .parent = &else_scope.base,5780 .parent = &else_scope.base,
5781 .gen_zir = &else_scope,5781 .gen_zir = &else_scope,
5782 .name = ident_name,5782 .name = ident_name,
5783 .inst = payload_inst,5783 .inst = payload_inst,
5784 .token_src = error_token,5784 .token_src = error_token,
5785 .id_cat = .@"capture",5785 .id_cat = .capture,
5786 };5786 };
5787 try else_scope.addDbgVar(.dbg_var_val, ident_name, payload_inst);5787 try else_scope.addDbgVar(.dbg_var_val, ident_name, payload_inst);
5788 break :s &payload_val_scope.base;5788 break :s &payload_val_scope.base;
...@@ -6045,14 +6045,14 @@ fn whileExpr(...@@ -6045,14 +6045,14 @@ fn whileExpr(
6045 break :s &then_scope.base;6045 break :s &then_scope.base;
6046 const payload_name_loc = payload_token + @boolToInt(payload_is_ref);6046 const payload_name_loc = payload_token + @boolToInt(payload_is_ref);
6047 const ident_name = try astgen.identAsString(payload_name_loc);6047 const ident_name = try astgen.identAsString(payload_name_loc);
6048 try astgen.detectLocalShadowing(&then_scope.base, ident_name, payload_name_loc, ident_bytes, .@"capture");6048 try astgen.detectLocalShadowing(&then_scope.base, ident_name, payload_name_loc, ident_bytes, .capture);
6049 payload_val_scope = .{6049 payload_val_scope = .{
6050 .parent = &then_scope.base,6050 .parent = &then_scope.base,
6051 .gen_zir = &then_scope,6051 .gen_zir = &then_scope,
6052 .name = ident_name,6052 .name = ident_name,
6053 .inst = indexToRef(payload_inst),6053 .inst = indexToRef(payload_inst),
6054 .token_src = payload_token,6054 .token_src = payload_token,
6055 .id_cat = .@"capture",6055 .id_cat = .capture,
6056 };6056 };
6057 dbg_var_name = ident_name;6057 dbg_var_name = ident_name;
6058 dbg_var_inst = indexToRef(payload_inst);6058 dbg_var_inst = indexToRef(payload_inst);
...@@ -6073,14 +6073,14 @@ fn whileExpr(...@@ -6073,14 +6073,14 @@ fn whileExpr(
6073 const ident_bytes = tree.tokenSlice(ident_token);6073 const ident_bytes = tree.tokenSlice(ident_token);
6074 if (mem.eql(u8, "_", ident_bytes))6074 if (mem.eql(u8, "_", ident_bytes))
6075 break :s &then_scope.base;6075 break :s &then_scope.base;
6076 try astgen.detectLocalShadowing(&then_scope.base, ident_name, ident_token, ident_bytes, .@"capture");6076 try astgen.detectLocalShadowing(&then_scope.base, ident_name, ident_token, ident_bytes, .capture);
6077 payload_val_scope = .{6077 payload_val_scope = .{
6078 .parent = &then_scope.base,6078 .parent = &then_scope.base,
6079 .gen_zir = &then_scope,6079 .gen_zir = &then_scope,
6080 .name = ident_name,6080 .name = ident_name,
6081 .inst = indexToRef(payload_inst),6081 .inst = indexToRef(payload_inst),
6082 .token_src = ident_token,6082 .token_src = ident_token,
6083 .id_cat = .@"capture",6083 .id_cat = .capture,
6084 };6084 };
6085 dbg_var_name = ident_name;6085 dbg_var_name = ident_name;
6086 dbg_var_inst = indexToRef(payload_inst);6086 dbg_var_inst = indexToRef(payload_inst);
...@@ -6154,14 +6154,14 @@ fn whileExpr(...@@ -6154,14 +6154,14 @@ fn whileExpr(
6154 const ident_bytes = tree.tokenSlice(error_token);6154 const ident_bytes = tree.tokenSlice(error_token);
6155 if (mem.eql(u8, ident_bytes, "_"))6155 if (mem.eql(u8, ident_bytes, "_"))
6156 break :s &else_scope.base;6156 break :s &else_scope.base;
6157 try astgen.detectLocalShadowing(&else_scope.base, ident_name, error_token, ident_bytes, .@"capture");6157 try astgen.detectLocalShadowing(&else_scope.base, ident_name, error_token, ident_bytes, .capture);
6158 payload_val_scope = .{6158 payload_val_scope = .{
6159 .parent = &else_scope.base,6159 .parent = &else_scope.base,
6160 .gen_zir = &else_scope,6160 .gen_zir = &else_scope,
6161 .name = ident_name,6161 .name = ident_name,
6162 .inst = else_payload_inst,6162 .inst = else_payload_inst,
6163 .token_src = error_token,6163 .token_src = error_token,
6164 .id_cat = .@"capture",6164 .id_cat = .capture,
6165 };6165 };
6166 try else_scope.addDbgVar(.dbg_var_val, ident_name, else_payload_inst);6166 try else_scope.addDbgVar(.dbg_var_val, ident_name, else_payload_inst);
6167 break :s &payload_val_scope.base;6167 break :s &payload_val_scope.base;
...@@ -6326,14 +6326,14 @@ fn forExpr(...@@ -6326,14 +6326,14 @@ fn forExpr(
6326 .lhs = array_ptr,6326 .lhs = array_ptr,
6327 .rhs = index,6327 .rhs = index,
6328 });6328 });
6329 try astgen.detectLocalShadowing(&then_scope.base, name_str_index, ident, value_name, .@"capture");6329 try astgen.detectLocalShadowing(&then_scope.base, name_str_index, ident, value_name, .capture);
6330 payload_val_scope = .{6330 payload_val_scope = .{
6331 .parent = &then_scope.base,6331 .parent = &then_scope.base,
6332 .gen_zir = &then_scope,6332 .gen_zir = &then_scope,
6333 .name = name_str_index,6333 .name = name_str_index,
6334 .inst = payload_inst,6334 .inst = payload_inst,
6335 .token_src = ident,6335 .token_src = ident,
6336 .id_cat = .@"capture",6336 .id_cat = .capture,
6337 };6337 };
6338 try then_scope.addDbgVar(.dbg_var_val, name_str_index, payload_inst);6338 try then_scope.addDbgVar(.dbg_var_val, name_str_index, payload_inst);
6339 payload_sub_scope = &payload_val_scope.base;6339 payload_sub_scope = &payload_val_scope.base;
...@@ -6672,14 +6672,14 @@ fn switchExpr(...@@ -6672,14 +6672,14 @@ fn switchExpr(
6672 });6672 });
6673 }6673 }
6674 const capture_name = try astgen.identAsString(ident);6674 const capture_name = try astgen.identAsString(ident);
6675 try astgen.detectLocalShadowing(&case_scope.base, capture_name, ident, ident_slice, .@"capture");6675 try astgen.detectLocalShadowing(&case_scope.base, capture_name, ident, ident_slice, .capture);
6676 capture_val_scope = .{6676 capture_val_scope = .{
6677 .parent = &case_scope.base,6677 .parent = &case_scope.base,
6678 .gen_zir = &case_scope,6678 .gen_zir = &case_scope,
6679 .name = capture_name,6679 .name = capture_name,
6680 .inst = indexToRef(capture_inst),6680 .inst = indexToRef(capture_inst),
6681 .token_src = payload_token,6681 .token_src = payload_token,
6682 .id_cat = .@"capture",6682 .id_cat = .capture,
6683 };6683 };
6684 dbg_var_name = capture_name;6684 dbg_var_name = capture_name;
6685 dbg_var_inst = indexToRef(capture_inst);6685 dbg_var_inst = indexToRef(capture_inst);
...@@ -10453,7 +10453,7 @@ const Scope = struct {...@@ -10453,7 +10453,7 @@ const Scope = struct {
10453 @"local variable",10453 @"local variable",
10454 @"loop index capture",10454 @"loop index capture",
10455 @"switch tag capture",10455 @"switch tag capture",
10456 @"capture",10456 capture,
10457 };10457 };
1045810458
10459 /// This is always a `const` local and importantly the `inst` is a value type, not a pointer.10459 /// This is always a `const` local and importantly the `inst` is a value type, not a pointer.
src/Autodoc.zig+4-4
...@@ -660,8 +660,8 @@ const DocData = struct {...@@ -660,8 +660,8 @@ const DocData = struct {
660 comptimeExpr: usize, // index in `comptimeExprs`660 comptimeExpr: usize, // index in `comptimeExprs`
661 void: struct {},661 void: struct {},
662 @"unreachable": struct {},662 @"unreachable": struct {},
663 @"null": struct {},663 null: struct {},
664 @"undefined": struct {},664 undefined: struct {},
665 @"struct": []FieldVal,665 @"struct": []FieldVal,
666 bool: bool,666 bool: bool,
667 @"anytype": struct {},667 @"anytype": struct {},
...@@ -4217,7 +4217,7 @@ fn walkRef(...@@ -4217,7 +4217,7 @@ fn walkRef(
4217 );4217 );
4218 },4218 },
4219 .undef => {4219 .undef => {
4220 return DocData.WalkResult{ .expr = .@"undefined" };4220 return DocData.WalkResult{ .expr = .undefined };
4221 },4221 },
4222 .zero => {4222 .zero => {
4223 return DocData.WalkResult{4223 return DocData.WalkResult{
...@@ -4245,7 +4245,7 @@ fn walkRef(...@@ -4245,7 +4245,7 @@ fn walkRef(
4245 };4245 };
4246 },4246 },
4247 .null_value => {4247 .null_value => {
4248 return DocData.WalkResult{ .expr = .@"null" };4248 return DocData.WalkResult{ .expr = .null };
4249 },4249 },
4250 .bool_true => {4250 .bool_true => {
4251 return DocData.WalkResult{4251 return DocData.WalkResult{
src/InternPool.zig+2-2
...@@ -168,9 +168,9 @@ pub const Simple = enum(u32) {...@@ -168,9 +168,9 @@ pub const Simple = enum(u32) {
168 null_type,168 null_type,
169 undefined_type,169 undefined_type,
170 enum_literal_type,170 enum_literal_type,
171 @"undefined",171 undefined,
172 void_value,172 void_value,
173 @"null",173 null,
174 bool_true,174 bool_true,
175 bool_false,175 bool_false,
176};176};
src/Sema.zig+51-51
...@@ -1716,7 +1716,7 @@ fn analyzeAsType(...@@ -1716,7 +1716,7 @@ fn analyzeAsType(
1716 src: LazySrcLoc,1716 src: LazySrcLoc,
1717 air_inst: Air.Inst.Ref,1717 air_inst: Air.Inst.Ref,
1718) !Type {1718) !Type {
1719 const wanted_type = Type.initTag(.@"type");1719 const wanted_type = Type.initTag(.type);
1720 const coerced_inst = try sema.coerce(block, wanted_type, air_inst, src);1720 const coerced_inst = try sema.coerce(block, wanted_type, air_inst, src);
1721 const val = try sema.resolveConstValue(block, src, coerced_inst, "types must be comptime-known");1721 const val = try sema.resolveConstValue(block, src, coerced_inst, "types must be comptime-known");
1722 var buffer: Value.ToTypeBuffer = undefined;1722 var buffer: Value.ToTypeBuffer = undefined;
...@@ -2396,9 +2396,9 @@ fn coerceResultPtr(...@@ -2396,9 +2396,9 @@ fn coerceResultPtr(
2396 if (try sema.resolveDefinedValue(block, src, new_ptr)) |ptr_val| {2396 if (try sema.resolveDefinedValue(block, src, new_ptr)) |ptr_val| {
2397 return sema.addConstant(ptr_ty, ptr_val);2397 return sema.addConstant(ptr_ty, ptr_val);
2398 }2398 }
2399 if (pointee_ty.eql(Type.@"null", sema.mod)) {2399 if (pointee_ty.eql(Type.null, sema.mod)) {
2400 const opt_ty = sema.typeOf(new_ptr).childType();2400 const opt_ty = sema.typeOf(new_ptr).childType();
2401 const null_inst = try sema.addConstant(opt_ty, Value.@"null");2401 const null_inst = try sema.addConstant(opt_ty, Value.null);
2402 _ = try block.addBinOp(.store, new_ptr, null_inst);2402 _ = try block.addBinOp(.store, new_ptr, null_inst);
2403 return Air.Inst.Ref.void_value;2403 return Air.Inst.Ref.void_value;
2404 }2404 }
...@@ -2691,7 +2691,7 @@ fn zirEnumDecl(...@@ -2691,7 +2691,7 @@ fn zirEnumDecl(
26912691
2692 enum_obj.* = .{2692 enum_obj.* = .{
2693 .owner_decl = new_decl_index,2693 .owner_decl = new_decl_index,
2694 .tag_ty = Type.@"null",2694 .tag_ty = Type.null,
2695 .tag_ty_inferred = true,2695 .tag_ty_inferred = true,
2696 .fields = .{},2696 .fields = .{},
2697 .values = .{},2697 .values = .{},
...@@ -2962,7 +2962,7 @@ fn zirUnionDecl(...@@ -2962,7 +2962,7 @@ fn zirUnionDecl(
2962 errdefer mod.abortAnonDecl(new_decl_index);2962 errdefer mod.abortAnonDecl(new_decl_index);
2963 union_obj.* = .{2963 union_obj.* = .{
2964 .owner_decl = new_decl_index,2964 .owner_decl = new_decl_index,
2965 .tag_ty = Type.initTag(.@"null"),2965 .tag_ty = Type.initTag(.null),
2966 .fields = .{},2966 .fields = .{},
2967 .zir_index = inst,2967 .zir_index = inst,
2968 .layout = small.layout,2968 .layout = small.layout,
...@@ -9885,7 +9885,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError...@@ -9885,7 +9885,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
9885 .{},9885 .{},
9886 );9886 );
9887 }9887 }
9888 else_error_ty = Type.@"anyerror";9888 else_error_ty = Type.anyerror;
9889 } else else_validation: {9889 } else else_validation: {
9890 var maybe_msg: ?*Module.ErrorMsg = null;9890 var maybe_msg: ?*Module.ErrorMsg = null;
9891 errdefer if (maybe_msg) |msg| msg.destroy(sema.gpa);9891 errdefer if (maybe_msg) |msg| msg.destroy(sema.gpa);
...@@ -11558,7 +11558,7 @@ fn zirShl(...@@ -11558,7 +11558,7 @@ fn zirShl(
11558 })11558 })
11559 else11559 else
11560 ov_bit;11560 ov_bit;
11561 const zero_ov = try sema.addConstant(Type.@"u1", Value.zero);11561 const zero_ov = try sema.addConstant(Type.u1, Value.zero);
11562 const no_ov = try block.addBinOp(.cmp_eq, any_ov_bit, zero_ov);11562 const no_ov = try block.addBinOp(.cmp_eq, any_ov_bit, zero_ov);
1156311563
11564 try sema.addSafetyCheck(block, no_ov, .shl_overflow);11564 try sema.addSafetyCheck(block, no_ov, .shl_overflow);
...@@ -13452,7 +13452,7 @@ fn zirOverflowArithmetic(...@@ -13452,7 +13452,7 @@ fn zirOverflowArithmetic(
13452 const ov_ty = tuple_ty.tupleFields().types[1];13452 const ov_ty = tuple_ty.tupleFields().types[1];
13453 // TODO: Remove and use `ov_ty` instead.13453 // TODO: Remove and use `ov_ty` instead.
13454 // This is a temporary type used until overflow arithmetic properly returns `u1` instead of `bool`.13454 // This is a temporary type used until overflow arithmetic properly returns `u1` instead of `bool`.
13455 const overflowed_ty = if (dest_ty.zigTypeTag() == .Vector) try Type.vector(sema.arena, dest_ty.vectorLen(), Type.@"bool") else Type.@"bool";13455 const overflowed_ty = if (dest_ty.zigTypeTag() == .Vector) try Type.vector(sema.arena, dest_ty.vectorLen(), Type.bool) else Type.bool;
1345613456
13457 const result: struct {13457 const result: struct {
13458 /// TODO: Rename to `overflow_bit` and make of type `u1`.13458 /// TODO: Rename to `overflow_bit` and make of type `u1`.
...@@ -13615,7 +13615,7 @@ fn zirOverflowArithmetic(...@@ -13615,7 +13615,7 @@ fn zirOverflowArithmetic(
13615}13615}
1361613616
13617fn overflowArithmeticTupleType(sema: *Sema, ty: Type) !Type {13617fn overflowArithmeticTupleType(sema: *Sema, ty: Type) !Type {
13618 const ov_ty = if (ty.zigTypeTag() == .Vector) try Type.vector(sema.arena, ty.vectorLen(), Type.@"u1") else Type.@"u1";13618 const ov_ty = if (ty.zigTypeTag() == .Vector) try Type.vector(sema.arena, ty.vectorLen(), Type.u1) else Type.u1;
1361913619
13620 const types = try sema.arena.alloc(Type, 2);13620 const types = try sema.arena.alloc(Type, 2);
13621 const values = try sema.arena.alloc(Value, 2);13621 const values = try sema.arena.alloc(Value, 2);
...@@ -14075,7 +14075,7 @@ fn analyzeArithmetic(...@@ -14075,7 +14075,7 @@ fn analyzeArithmetic(
14075 })14075 })
14076 else14076 else
14077 ov_bit;14077 ov_bit;
14078 const zero_ov = try sema.addConstant(Type.@"u1", Value.zero);14078 const zero_ov = try sema.addConstant(Type.u1, Value.zero);
14079 const no_ov = try block.addBinOp(.cmp_eq, any_ov_bit, zero_ov);14079 const no_ov = try block.addBinOp(.cmp_eq, any_ov_bit, zero_ov);
1408014080
14081 try sema.addSafetyCheck(block, no_ov, .integer_overflow);14081 try sema.addSafetyCheck(block, no_ov, .integer_overflow);
...@@ -14569,7 +14569,7 @@ fn cmpSelf(...@@ -14569,7 +14569,7 @@ fn cmpSelf(
14569 if (rhs_val.isUndef()) return sema.addConstUndef(Type.bool);14569 if (rhs_val.isUndef()) return sema.addConstUndef(Type.bool);
1457014570
14571 if (resolved_type.zigTypeTag() == .Vector) {14571 if (resolved_type.zigTypeTag() == .Vector) {
14572 const result_ty = try Type.vector(sema.arena, resolved_type.vectorLen(), Type.@"bool");14572 const result_ty = try Type.vector(sema.arena, resolved_type.vectorLen(), Type.bool);
14573 const cmp_val = try sema.compareVector(lhs_val, op, rhs_val, resolved_type);14573 const cmp_val = try sema.compareVector(lhs_val, op, rhs_val, resolved_type);
14574 return sema.addConstant(result_ty, cmp_val);14574 return sema.addConstant(result_ty, cmp_val);
14575 }14575 }
...@@ -14600,7 +14600,7 @@ fn cmpSelf(...@@ -14600,7 +14600,7 @@ fn cmpSelf(
14600 };14600 };
14601 try sema.requireRuntimeBlock(block, src, runtime_src);14601 try sema.requireRuntimeBlock(block, src, runtime_src);
14602 if (resolved_type.zigTypeTag() == .Vector) {14602 if (resolved_type.zigTypeTag() == .Vector) {
14603 const result_ty = try Type.vector(sema.arena, resolved_type.vectorLen(), Type.@"bool");14603 const result_ty = try Type.vector(sema.arena, resolved_type.vectorLen(), Type.bool);
14604 const result_ty_ref = try sema.addType(result_ty);14604 const result_ty_ref = try sema.addType(result_ty);
14605 return block.addCmpVector(casted_lhs, casted_rhs, op, result_ty_ref);14605 return block.addCmpVector(casted_lhs, casted_rhs, op, result_ty_ref);
14606 }14606 }
...@@ -14932,63 +14932,63 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai...@@ -14932,63 +14932,63 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
14932 type_info_ty,14932 type_info_ty,
14933 try Value.Tag.@"union".create(sema.arena, .{14933 try Value.Tag.@"union".create(sema.arena, .{
14934 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.Type)),14934 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.Type)),
14935 .val = Value.@"void",14935 .val = Value.void,
14936 }),14936 }),
14937 ),14937 ),
14938 .Void => return sema.addConstant(14938 .Void => return sema.addConstant(
14939 type_info_ty,14939 type_info_ty,
14940 try Value.Tag.@"union".create(sema.arena, .{14940 try Value.Tag.@"union".create(sema.arena, .{
14941 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.Void)),14941 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.Void)),
14942 .val = Value.@"void",14942 .val = Value.void,
14943 }),14943 }),
14944 ),14944 ),
14945 .Bool => return sema.addConstant(14945 .Bool => return sema.addConstant(
14946 type_info_ty,14946 type_info_ty,
14947 try Value.Tag.@"union".create(sema.arena, .{14947 try Value.Tag.@"union".create(sema.arena, .{
14948 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.Bool)),14948 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.Bool)),
14949 .val = Value.@"void",14949 .val = Value.void,
14950 }),14950 }),
14951 ),14951 ),
14952 .NoReturn => return sema.addConstant(14952 .NoReturn => return sema.addConstant(
14953 type_info_ty,14953 type_info_ty,
14954 try Value.Tag.@"union".create(sema.arena, .{14954 try Value.Tag.@"union".create(sema.arena, .{
14955 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.NoReturn)),14955 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.NoReturn)),
14956 .val = Value.@"void",14956 .val = Value.void,
14957 }),14957 }),
14958 ),14958 ),
14959 .ComptimeFloat => return sema.addConstant(14959 .ComptimeFloat => return sema.addConstant(
14960 type_info_ty,14960 type_info_ty,
14961 try Value.Tag.@"union".create(sema.arena, .{14961 try Value.Tag.@"union".create(sema.arena, .{
14962 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.ComptimeFloat)),14962 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.ComptimeFloat)),
14963 .val = Value.@"void",14963 .val = Value.void,
14964 }),14964 }),
14965 ),14965 ),
14966 .ComptimeInt => return sema.addConstant(14966 .ComptimeInt => return sema.addConstant(
14967 type_info_ty,14967 type_info_ty,
14968 try Value.Tag.@"union".create(sema.arena, .{14968 try Value.Tag.@"union".create(sema.arena, .{
14969 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.ComptimeInt)),14969 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.ComptimeInt)),
14970 .val = Value.@"void",14970 .val = Value.void,
14971 }),14971 }),
14972 ),14972 ),
14973 .Undefined => return sema.addConstant(14973 .Undefined => return sema.addConstant(
14974 type_info_ty,14974 type_info_ty,
14975 try Value.Tag.@"union".create(sema.arena, .{14975 try Value.Tag.@"union".create(sema.arena, .{
14976 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.Undefined)),14976 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.Undefined)),
14977 .val = Value.@"void",14977 .val = Value.void,
14978 }),14978 }),
14979 ),14979 ),
14980 .Null => return sema.addConstant(14980 .Null => return sema.addConstant(
14981 type_info_ty,14981 type_info_ty,
14982 try Value.Tag.@"union".create(sema.arena, .{14982 try Value.Tag.@"union".create(sema.arena, .{
14983 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.Null)),14983 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.Null)),
14984 .val = Value.@"void",14984 .val = Value.void,
14985 }),14985 }),
14986 ),14986 ),
14987 .EnumLiteral => return sema.addConstant(14987 .EnumLiteral => return sema.addConstant(
14988 type_info_ty,14988 type_info_ty,
14989 try Value.Tag.@"union".create(sema.arena, .{14989 try Value.Tag.@"union".create(sema.arena, .{
14990 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.EnumLiteral)),14990 .tag = try Value.Tag.enum_field_index.create(sema.arena, @enumToInt(std.builtin.TypeId.EnumLiteral)),
14991 .val = Value.@"void",14991 .val = Value.void,
14992 }),14992 }),
14993 ),14993 ),
14994 .Fn => {14994 .Fn => {
...@@ -15003,7 +15003,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai...@@ -15003,7 +15003,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
15003 const param_ty = info.param_types[i];15003 const param_ty = info.param_types[i];
15004 const is_generic = param_ty.tag() == .generic_poison;15004 const is_generic = param_ty.tag() == .generic_poison;
15005 const param_ty_val = if (is_generic)15005 const param_ty_val = if (is_generic)
15006 Value.@"null"15006 Value.null
15007 else15007 else
15008 try Value.Tag.opt_payload.create(15008 try Value.Tag.opt_payload.create(
15009 params_anon_decl.arena(),15009 params_anon_decl.arena(),
...@@ -15015,7 +15015,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai...@@ -15015,7 +15015,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
15015 // is_generic: bool,15015 // is_generic: bool,
15016 Value.makeBool(is_generic),15016 Value.makeBool(is_generic),
15017 // is_noalias: bool,15017 // is_noalias: bool,
15018 Value.@"false", // TODO15018 Value.false, // TODO
15019 // arg_type: ?type,15019 // arg_type: ?type,
15020 param_ty_val,15020 param_ty_val,
15021 };15021 };
...@@ -15068,7 +15068,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai...@@ -15068,7 +15068,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
15068 try Value.Tag.ty.create(sema.arena, info.return_type),15068 try Value.Tag.ty.create(sema.arena, info.return_type),
15069 )15069 )
15070 else15070 else
15071 Value.@"null";15071 Value.null;
1507215072
15073 const field_values = try sema.arena.create([6]Value);15073 const field_values = try sema.arena.create([6]Value);
15074 field_values.* = .{15074 field_values.* = .{
...@@ -15287,7 +15287,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai...@@ -15287,7 +15287,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
15287 .len = try Value.Tag.int_u64.create(sema.arena, vals.len),15287 .len = try Value.Tag.int_u64.create(sema.arena, vals.len),
15288 });15288 });
15289 break :v try Value.Tag.opt_payload.create(sema.arena, slice_val);15289 break :v try Value.Tag.opt_payload.create(sema.arena, slice_val);
15290 } else Value.@"null";15290 } else Value.null;
1529115291
15292 // Construct Type{ .ErrorSet = errors_val }15292 // Construct Type{ .ErrorSet = errors_val }
15293 return sema.addConstant(15293 return sema.addConstant(
...@@ -15498,7 +15498,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai...@@ -15498,7 +15498,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
15498 const enum_tag_ty_val = if (union_ty.unionTagType()) |tag_ty| v: {15498 const enum_tag_ty_val = if (union_ty.unionTagType()) |tag_ty| v: {
15499 const ty_val = try Value.Tag.ty.create(sema.arena, tag_ty);15499 const ty_val = try Value.Tag.ty.create(sema.arena, tag_ty);
15500 break :v try Value.Tag.opt_payload.create(sema.arena, ty_val);15500 break :v try Value.Tag.opt_payload.create(sema.arena, ty_val);
15501 } else Value.@"null";15501 } else Value.null;
1550215502
15503 const field_values = try sema.arena.create([4]Value);15503 const field_values = try sema.arena.create([4]Value);
15504 field_values.* = .{15504 field_values.* = .{
...@@ -15848,7 +15848,7 @@ fn zirLog2IntType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError...@@ -15848,7 +15848,7 @@ fn zirLog2IntType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
1584815848
15849fn log2IntType(sema: *Sema, block: *Block, operand: Type, src: LazySrcLoc) CompileError!Type {15849fn log2IntType(sema: *Sema, block: *Block, operand: Type, src: LazySrcLoc) CompileError!Type {
15850 switch (operand.zigTypeTag()) {15850 switch (operand.zigTypeTag()) {
15851 .ComptimeInt => return Type.@"comptime_int",15851 .ComptimeInt => return Type.comptime_int,
15852 .Int => {15852 .Int => {
15853 const bits = operand.bitSize(sema.mod.getTarget());15853 const bits = operand.bitSize(sema.mod.getTarget());
15854 const count = if (bits == 0)15854 const count = if (bits == 0)
...@@ -17518,7 +17518,7 @@ fn getErrorReturnTrace(sema: *Sema, block: *Block) CompileError!Air.Inst.Ref {...@@ -17518,7 +17518,7 @@ fn getErrorReturnTrace(sema: *Sema, block: *Block) CompileError!Air.Inst.Ref {
17518 {17518 {
17519 return block.addTy(.err_return_trace, opt_ptr_stack_trace_ty);17519 return block.addTy(.err_return_trace, opt_ptr_stack_trace_ty);
17520 }17520 }
17521 return sema.addConstant(opt_ptr_stack_trace_ty, Value.@"null");17521 return sema.addConstant(opt_ptr_stack_trace_ty, Value.null);
17522}17522}
1752317523
17524fn zirFrame(17524fn zirFrame(
...@@ -17760,11 +17760,11 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in...@@ -17760,11 +17760,11 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in
1776017760
17761 const bits = @intCast(u16, bits_val.toUnsignedInt(target));17761 const bits = @intCast(u16, bits_val.toUnsignedInt(target));
17762 const ty = switch (bits) {17762 const ty = switch (bits) {
17763 16 => Type.@"f16",17763 16 => Type.f16,
17764 32 => Type.@"f32",17764 32 => Type.f32,
17765 64 => Type.@"f64",17765 64 => Type.f64,
17766 80 => Type.@"f80",17766 80 => Type.f80,
17767 128 => Type.@"f128",17767 128 => Type.f128,
17768 else => return sema.fail(block, src, "{}-bit float unsupported", .{bits}),17768 else => return sema.fail(block, src, "{}-bit float unsupported", .{bits}),
17769 };17769 };
17770 return sema.addType(ty);17770 return sema.addType(ty);
...@@ -18029,7 +18029,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in...@@ -18029,7 +18029,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in
1802918029
18030 enum_obj.* = .{18030 enum_obj.* = .{
18031 .owner_decl = new_decl_index,18031 .owner_decl = new_decl_index,
18032 .tag_ty = Type.@"null",18032 .tag_ty = Type.null,
18033 .tag_ty_inferred = false,18033 .tag_ty_inferred = false,
18034 .fields = .{},18034 .fields = .{},
18035 .values = .{},18035 .values = .{},
...@@ -18077,7 +18077,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in...@@ -18077,7 +18077,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in
18077 // TODO: better source location18077 // TODO: better source location
18078 return sema.fail(block, src, "field '{s}' with enumeration value '{}' is too large for backing int type '{}'", .{18078 return sema.fail(block, src, "field '{s}' with enumeration value '{}' is too large for backing int type '{}'", .{
18079 field_name,18079 field_name,
18080 value_val.fmtValue(Type.@"comptime_int", mod),18080 value_val.fmtValue(Type.comptime_int, mod),
18081 enum_obj.tag_ty.fmt(mod),18081 enum_obj.tag_ty.fmt(mod),
18082 });18082 });
18083 }18083 }
...@@ -18187,7 +18187,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in...@@ -18187,7 +18187,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in
18187 errdefer mod.abortAnonDecl(new_decl_index);18187 errdefer mod.abortAnonDecl(new_decl_index);
18188 union_obj.* = .{18188 union_obj.* = .{
18189 .owner_decl = new_decl_index,18189 .owner_decl = new_decl_index,
18190 .tag_ty = Type.initTag(.@"null"),18190 .tag_ty = Type.initTag(.null),
18191 .fields = .{},18191 .fields = .{},
18192 .zir_index = inst,18192 .zir_index = inst,
18193 .layout = layout,18193 .layout = layout,
...@@ -19918,7 +19918,7 @@ fn zirCmpxchg(...@@ -19918,7 +19918,7 @@ fn zirCmpxchg(
1991819918
19919 // special case zero bit types19919 // special case zero bit types
19920 if ((try sema.typeHasOnePossibleValue(elem_ty)) != null) {19920 if ((try sema.typeHasOnePossibleValue(elem_ty)) != null) {
19921 return sema.addConstant(result_ty, Value.@"null");19921 return sema.addConstant(result_ty, Value.null);
19922 }19922 }
1992319923
19924 const runtime_src = if (try sema.resolveDefinedValue(block, ptr_src, ptr)) |ptr_val| rs: {19924 const runtime_src = if (try sema.resolveDefinedValue(block, ptr_src, ptr)) |ptr_val| rs: {
...@@ -19933,7 +19933,7 @@ fn zirCmpxchg(...@@ -19933,7 +19933,7 @@ fn zirCmpxchg(
19933 const stored_val = (try sema.pointerDeref(block, ptr_src, ptr_val, ptr_ty)) orelse break :rs ptr_src;19933 const stored_val = (try sema.pointerDeref(block, ptr_src, ptr_val, ptr_ty)) orelse break :rs ptr_src;
19934 const result_val = if (stored_val.eql(expected_val, elem_ty, sema.mod)) blk: {19934 const result_val = if (stored_val.eql(expected_val, elem_ty, sema.mod)) blk: {
19935 try sema.storePtr(block, src, ptr, new_value);19935 try sema.storePtr(block, src, ptr, new_value);
19936 break :blk Value.@"null";19936 break :blk Value.null;
19937 } else try Value.Tag.opt_payload.create(sema.arena, stored_val);19937 } else try Value.Tag.opt_payload.create(sema.arena, stored_val);
1993819938
19939 return sema.addConstant(result_ty, result_val);19939 return sema.addConstant(result_ty, result_val);
...@@ -20074,7 +20074,7 @@ fn zirShuffle(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air...@@ -20074,7 +20074,7 @@ fn zirShuffle(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
20074 };20074 };
20075 mask_ty = try Type.Tag.vector.create(sema.arena, .{20075 mask_ty = try Type.Tag.vector.create(sema.arena, .{
20076 .len = mask_len,20076 .len = mask_len,
20077 .elem_type = Type.@"i32",20077 .elem_type = Type.i32,
20078 });20078 });
20079 mask = try sema.coerce(block, mask_ty, mask, mask_src);20079 mask = try sema.coerce(block, mask_ty, mask, mask_src);
20080 const mask_val = try sema.resolveConstMaybeUndefVal(block, mask_src, mask, "shuffle mask must be comptime-known");20080 const mask_val = try sema.resolveConstMaybeUndefVal(block, mask_src, mask, "shuffle mask must be comptime-known");
...@@ -22133,7 +22133,7 @@ fn panicWithMsg(...@@ -22133,7 +22133,7 @@ fn panicWithMsg(
22133 });22133 });
22134 const null_stack_trace = try sema.addConstant(22134 const null_stack_trace = try sema.addConstant(
22135 try Type.optional(arena, ptr_stack_trace_ty),22135 try Type.optional(arena, ptr_stack_trace_ty),
22136 Value.@"null",22136 Value.null,
22137 );22137 );
22138 const args: [3]Air.Inst.Ref = .{ msg_inst, null_stack_trace, .null_value };22138 const args: [3]Air.Inst.Ref = .{ msg_inst, null_stack_trace, .null_value };
22139 _ = try sema.analyzeCall(block, panic_fn, src, src, .auto, false, &args, null);22139 _ = try sema.analyzeCall(block, panic_fn, src, src, .auto, false, &args, null);
...@@ -23976,7 +23976,7 @@ fn coerceExtra(...@@ -23976,7 +23976,7 @@ fn coerceExtra(
2397623976
23977 // null to ?T23977 // null to ?T
23978 if (inst_ty.zigTypeTag() == .Null) {23978 if (inst_ty.zigTypeTag() == .Null) {
23979 return sema.addConstant(dest_ty, Value.@"null");23979 return sema.addConstant(dest_ty, Value.null);
23980 }23980 }
2398123981
23982 // cast from ?*T and ?[*]T to ?*anyopaque23982 // cast from ?*T and ?[*]T to ?*anyopaque
...@@ -24135,7 +24135,7 @@ fn coerceExtra(...@@ -24135,7 +24135,7 @@ fn coerceExtra(
24135 // coercion to C pointer24135 // coercion to C pointer
24136 .C => switch (inst_ty.zigTypeTag()) {24136 .C => switch (inst_ty.zigTypeTag()) {
24137 .Null => {24137 .Null => {
24138 return sema.addConstant(dest_ty, Value.@"null");24138 return sema.addConstant(dest_ty, Value.null);
24139 },24139 },
24140 .ComptimeInt => {24140 .ComptimeInt => {
24141 const addr = sema.coerceExtra(block, Type.usize, inst, inst_src, .{ .report_err = false }) catch |err| switch (err) {24141 const addr = sema.coerceExtra(block, Type.usize, inst, inst_src, .{ .report_err = false }) catch |err| switch (err) {
...@@ -27361,7 +27361,7 @@ fn refValue(sema: *Sema, block: *Block, ty: Type, val: Value) !Value {...@@ -27361,7 +27361,7 @@ fn refValue(sema: *Sema, block: *Block, ty: Type, val: Value) !Value {
27361}27361}
2736227362
27363fn optRefValue(sema: *Sema, block: *Block, ty: Type, opt_val: ?Value) !Value {27363fn optRefValue(sema: *Sema, block: *Block, ty: Type, opt_val: ?Value) !Value {
27364 const val = opt_val orelse return Value.@"null";27364 const val = opt_val orelse return Value.null;
27365 const ptr_val = try sema.refValue(block, ty, val);27365 const ptr_val = try sema.refValue(block, ty, val);
27366 const result = try Value.Tag.opt_payload.create(sema.arena, ptr_val);27366 const result = try Value.Tag.opt_payload.create(sema.arena, ptr_val);
27367 return result;27367 return result;
...@@ -28301,7 +28301,7 @@ fn cmpVector(...@@ -28301,7 +28301,7 @@ fn cmpVector(
28301 assert(rhs_ty.zigTypeTag() == .Vector);28301 assert(rhs_ty.zigTypeTag() == .Vector);
28302 try sema.checkVectorizableBinaryOperands(block, src, lhs_ty, rhs_ty, lhs_src, rhs_src);28302 try sema.checkVectorizableBinaryOperands(block, src, lhs_ty, rhs_ty, lhs_src, rhs_src);
2830328303
28304 const result_ty = try Type.vector(sema.arena, lhs_ty.vectorLen(), Type.@"bool");28304 const result_ty = try Type.vector(sema.arena, lhs_ty.vectorLen(), Type.bool);
2830528305
28306 const runtime_src: LazySrcLoc = src: {28306 const runtime_src: LazySrcLoc = src: {
28307 if (try sema.resolveMaybeUndefVal(lhs)) |lhs_val| {28307 if (try sema.resolveMaybeUndefVal(lhs)) |lhs_val| {
...@@ -30419,7 +30419,7 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value {...@@ -30419,7 +30419,7 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value {
30419 var buf: Type.Payload.ElemType = undefined;30419 var buf: Type.Payload.ElemType = undefined;
30420 const child_ty = ty.optionalChild(&buf);30420 const child_ty = ty.optionalChild(&buf);
30421 if (child_ty.isNoReturn()) {30421 if (child_ty.isNoReturn()) {
30422 return Value.@"null";30422 return Value.null;
30423 } else {30423 } else {
30424 return null;30424 return null;
30425 }30425 }
...@@ -30539,8 +30539,8 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value {...@@ -30539,8 +30539,8 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value {
30539 .empty_struct, .empty_struct_literal => return Value.initTag(.empty_struct_value),30539 .empty_struct, .empty_struct_literal => return Value.initTag(.empty_struct_value),
30540 .void => return Value.void,30540 .void => return Value.void,
30541 .noreturn => return Value.initTag(.unreachable_value),30541 .noreturn => return Value.initTag(.unreachable_value),
30542 .@"null" => return Value.@"null",30542 .null => return Value.null,
30543 .@"undefined" => return Value.initTag(.undef),30543 .undefined => return Value.initTag(.undef),
3054430544
30545 .int_unsigned, .int_signed => {30545 .int_unsigned, .int_signed => {
30546 if (ty.cast(Type.Payload.Bits).?.data == 0) {30546 if (ty.cast(Type.Payload.Bits).?.data == 0) {
...@@ -30712,8 +30712,8 @@ pub fn addType(sema: *Sema, ty: Type) !Air.Inst.Ref {...@@ -30712,8 +30712,8 @@ pub fn addType(sema: *Sema, ty: Type) !Air.Inst.Ref {
30712 .comptime_float => return .comptime_float_type,30712 .comptime_float => return .comptime_float_type,
30713 .noreturn => return .noreturn_type,30713 .noreturn => return .noreturn_type,
30714 .@"anyframe" => return .anyframe_type,30714 .@"anyframe" => return .anyframe_type,
30715 .@"null" => return .null_type,30715 .null => return .null_type,
30716 .@"undefined" => return .undefined_type,30716 .undefined => return .undefined_type,
30717 .enum_literal => return .enum_literal_type,30717 .enum_literal => return .enum_literal_type,
30718 .atomic_order => return .atomic_order_type,30718 .atomic_order => return .atomic_order_type,
30719 .atomic_rmw_op => return .atomic_rmw_op_type,30719 .atomic_rmw_op => return .atomic_rmw_op_type,
...@@ -31102,8 +31102,8 @@ pub fn typeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool {...@@ -31102,8 +31102,8 @@ pub fn typeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool {
31102 .anyerror,31102 .anyerror,
31103 .noreturn,31103 .noreturn,
31104 .@"anyframe",31104 .@"anyframe",
31105 .@"null",31105 .null,
31106 .@"undefined",31106 .undefined,
31107 .atomic_order,31107 .atomic_order,
31108 .atomic_rmw_op,31108 .atomic_rmw_op,
31109 .calling_convention,31109 .calling_convention,
src/Zir.zig+2-2
...@@ -2367,7 +2367,7 @@ pub const Inst = struct {...@@ -2367,7 +2367,7 @@ pub const Inst = struct {
2367 },2367 },
23682368
2369 .undef = .{2369 .undef = .{
2370 .ty = Type.initTag(.@"undefined"),2370 .ty = Type.initTag(.undefined),
2371 .val = Value.initTag(.undef),2371 .val = Value.initTag(.undef),
2372 },2372 },
2373 .zero = .{2373 .zero = .{
...@@ -2395,7 +2395,7 @@ pub const Inst = struct {...@@ -2395,7 +2395,7 @@ pub const Inst = struct {
2395 .val = Value.initTag(.unreachable_value),2395 .val = Value.initTag(.unreachable_value),
2396 },2396 },
2397 .null_value = .{2397 .null_value = .{
2398 .ty = Type.initTag(.@"null"),2398 .ty = Type.initTag(.null),
2399 .val = Value.initTag(.null_value),2399 .val = Value.initTag(.null_value),
2400 },2400 },
2401 .bool_true = .{2401 .bool_true = .{
src/arch/aarch64/CodeGen.zig+12-12
...@@ -150,7 +150,7 @@ const MCValue = union(enum) {...@@ -150,7 +150,7 @@ const MCValue = union(enum) {
150 /// * got - the value is referenced indirectly via GOT entry index (the linker emits a got-type reloc)150 /// * got - the value is referenced indirectly via GOT entry index (the linker emits a got-type reloc)
151 /// * direct - the value is referenced directly via symbol index index (the linker emits a displacement reloc)151 /// * direct - the value is referenced directly via symbol index index (the linker emits a displacement reloc)
152 /// * import - the value is referenced indirectly via import entry index (the linker emits an import-type reloc)152 /// * import - the value is referenced indirectly via import entry index (the linker emits an import-type reloc)
153 linker_load: struct { @"type": enum { got, direct, import }, sym_index: u32 },153 linker_load: struct { type: enum { got, direct, import }, sym_index: u32 },
154 /// The value is one of the stack variables.154 /// The value is one of the stack variables.
155 ///155 ///
156 /// If the type is a pointer, it means the pointer address is in156 /// If the type is a pointer, it means the pointer address is in
...@@ -4024,7 +4024,7 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type...@@ -4024,7 +4024,7 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type
4024 },4024 },
4025 .memory => |addr| try self.genSetReg(Type.usize, src_reg, .{ .immediate = @intCast(u32, addr) }),4025 .memory => |addr| try self.genSetReg(Type.usize, src_reg, .{ .immediate = @intCast(u32, addr) }),
4026 .linker_load => |load_struct| {4026 .linker_load => |load_struct| {
4027 const tag: Mir.Inst.Tag = switch (load_struct.@"type") {4027 const tag: Mir.Inst.Tag = switch (load_struct.type) {
4028 .got => .load_memory_ptr_got,4028 .got => .load_memory_ptr_got,
4029 .direct => .load_memory_ptr_direct,4029 .direct => .load_memory_ptr_direct,
4030 .import => unreachable,4030 .import => unreachable,
...@@ -4347,7 +4347,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions....@@ -4347,7 +4347,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.
4347 const fn_owner_decl = mod.declPtr(func.owner_decl);4347 const fn_owner_decl = mod.declPtr(func.owner_decl);
4348 try self.genSetReg(Type.initTag(.u64), .x30, .{4348 try self.genSetReg(Type.initTag(.u64), .x30, .{
4349 .linker_load = .{4349 .linker_load = .{
4350 .@"type" = .got,4350 .type = .got,
4351 .sym_index = fn_owner_decl.link.macho.sym_index,4351 .sym_index = fn_owner_decl.link.macho.sym_index,
4352 },4352 },
4353 });4353 });
...@@ -4385,7 +4385,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions....@@ -4385,7 +4385,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.
4385 const fn_owner_decl = mod.declPtr(func.owner_decl);4385 const fn_owner_decl = mod.declPtr(func.owner_decl);
4386 try self.genSetReg(Type.initTag(.u64), .x30, .{4386 try self.genSetReg(Type.initTag(.u64), .x30, .{
4387 .linker_load = .{4387 .linker_load = .{
4388 .@"type" = .got,4388 .type = .got,
4389 .sym_index = fn_owner_decl.link.coff.sym_index,4389 .sym_index = fn_owner_decl.link.coff.sym_index,
4390 },4390 },
4391 });4391 });
...@@ -4406,7 +4406,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions....@@ -4406,7 +4406,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.
4406 const sym_index = try coff_file.getGlobalSymbol(mem.sliceTo(decl_name, 0));4406 const sym_index = try coff_file.getGlobalSymbol(mem.sliceTo(decl_name, 0));
4407 try self.genSetReg(Type.initTag(.u64), .x30, .{4407 try self.genSetReg(Type.initTag(.u64), .x30, .{
4408 .linker_load = .{4408 .linker_load = .{
4409 .@"type" = .import,4409 .type = .import,
4410 .sym_index = sym_index,4410 .sym_index = sym_index,
4411 },4411 },
4412 });4412 });
...@@ -5534,7 +5534,7 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro...@@ -5534,7 +5534,7 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro
5534 },5534 },
5535 .memory => |addr| try self.genSetReg(Type.usize, src_reg, .{ .immediate = addr }),5535 .memory => |addr| try self.genSetReg(Type.usize, src_reg, .{ .immediate = addr }),
5536 .linker_load => |load_struct| {5536 .linker_load => |load_struct| {
5537 const tag: Mir.Inst.Tag = switch (load_struct.@"type") {5537 const tag: Mir.Inst.Tag = switch (load_struct.type) {
5538 .got => .load_memory_ptr_got,5538 .got => .load_memory_ptr_got,
5539 .direct => .load_memory_ptr_direct,5539 .direct => .load_memory_ptr_direct,
5540 .import => unreachable,5540 .import => unreachable,
...@@ -5648,7 +5648,7 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void...@@ -5648,7 +5648,7 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void
5648 },5648 },
5649 .register_with_overflow => unreachable, // doesn't fit into a register5649 .register_with_overflow => unreachable, // doesn't fit into a register
5650 .linker_load => |load_struct| {5650 .linker_load => |load_struct| {
5651 const tag: Mir.Inst.Tag = switch (load_struct.@"type") {5651 const tag: Mir.Inst.Tag = switch (load_struct.type) {
5652 .got => .load_memory_got,5652 .got => .load_memory_got,
5653 .direct => .load_memory_direct,5653 .direct => .load_memory_direct,
5654 .import => .load_memory_import,5654 .import => .load_memory_import,
...@@ -5842,7 +5842,7 @@ fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) I...@@ -5842,7 +5842,7 @@ fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) I
5842 },5842 },
5843 .memory => |addr| try self.genSetReg(ptr_ty, src_reg, .{ .immediate = @intCast(u32, addr) }),5843 .memory => |addr| try self.genSetReg(ptr_ty, src_reg, .{ .immediate = @intCast(u32, addr) }),
5844 .linker_load => |load_struct| {5844 .linker_load => |load_struct| {
5845 const tag: Mir.Inst.Tag = switch (load_struct.@"type") {5845 const tag: Mir.Inst.Tag = switch (load_struct.type) {
5846 .got => .load_memory_ptr_got,5846 .got => .load_memory_ptr_got,
5847 .direct => .load_memory_ptr_direct,5847 .direct => .load_memory_ptr_direct,
5848 .import => unreachable,5848 .import => unreachable,
...@@ -6168,7 +6168,7 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl_index: Module.Decl.Index) Inne...@@ -6168,7 +6168,7 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl_index: Module.Decl.Index) Inne
6168 // the linker has enough info to perform relocations.6168 // the linker has enough info to perform relocations.
6169 assert(decl.link.macho.sym_index != 0);6169 assert(decl.link.macho.sym_index != 0);
6170 return MCValue{ .linker_load = .{6170 return MCValue{ .linker_load = .{
6171 .@"type" = .got,6171 .type = .got,
6172 .sym_index = decl.link.macho.sym_index,6172 .sym_index = decl.link.macho.sym_index,
6173 } };6173 } };
6174 } else if (self.bin_file.cast(link.File.Coff)) |_| {6174 } else if (self.bin_file.cast(link.File.Coff)) |_| {
...@@ -6176,7 +6176,7 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl_index: Module.Decl.Index) Inne...@@ -6176,7 +6176,7 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl_index: Module.Decl.Index) Inne
6176 // the linker has enough info to perform relocations.6176 // the linker has enough info to perform relocations.
6177 assert(decl.link.coff.sym_index != 0);6177 assert(decl.link.coff.sym_index != 0);
6178 return MCValue{ .linker_load = .{6178 return MCValue{ .linker_load = .{
6179 .@"type" = .got,6179 .type = .got,
6180 .sym_index = decl.link.coff.sym_index,6180 .sym_index = decl.link.coff.sym_index,
6181 } };6181 } };
6182 } else if (self.bin_file.cast(link.File.Plan9)) |p9| {6182 } else if (self.bin_file.cast(link.File.Plan9)) |p9| {
...@@ -6198,12 +6198,12 @@ fn lowerUnnamedConst(self: *Self, tv: TypedValue) InnerError!MCValue {...@@ -6198,12 +6198,12 @@ fn lowerUnnamedConst(self: *Self, tv: TypedValue) InnerError!MCValue {
6198 return MCValue{ .memory = vaddr };6198 return MCValue{ .memory = vaddr };
6199 } else if (self.bin_file.cast(link.File.MachO)) |_| {6199 } else if (self.bin_file.cast(link.File.MachO)) |_| {
6200 return MCValue{ .linker_load = .{6200 return MCValue{ .linker_load = .{
6201 .@"type" = .direct,6201 .type = .direct,
6202 .sym_index = local_sym_index,6202 .sym_index = local_sym_index,
6203 } };6203 } };
6204 } else if (self.bin_file.cast(link.File.Coff)) |_| {6204 } else if (self.bin_file.cast(link.File.Coff)) |_| {
6205 return MCValue{ .linker_load = .{6205 return MCValue{ .linker_load = .{
6206 .@"type" = .direct,6206 .type = .direct,
6207 .sym_index = local_sym_index,6207 .sym_index = local_sym_index,
6208 } };6208 } };
6209 } else if (self.bin_file.cast(link.File.Plan9)) |_| {6209 } else if (self.bin_file.cast(link.File.Plan9)) |_| {
src/arch/aarch64/Emit.zig+5-5
...@@ -687,7 +687,7 @@ fn mirCallExtern(emit: *Emit, inst: Mir.Inst.Index) !void {...@@ -687,7 +687,7 @@ fn mirCallExtern(emit: *Emit, inst: Mir.Inst.Index) !void {
687 const atom = macho_file.getAtomForSymbol(.{ .sym_index = relocation.atom_index, .file = null }).?;687 const atom = macho_file.getAtomForSymbol(.{ .sym_index = relocation.atom_index, .file = null }).?;
688 const target = macho_file.getGlobalByIndex(relocation.sym_index);688 const target = macho_file.getGlobalByIndex(relocation.sym_index);
689 try atom.addRelocation(macho_file, .{689 try atom.addRelocation(macho_file, .{
690 .@"type" = @enumToInt(std.macho.reloc_type_arm64.ARM64_RELOC_BRANCH26),690 .type = @enumToInt(std.macho.reloc_type_arm64.ARM64_RELOC_BRANCH26),
691 .target = target,691 .target = target,
692 .offset = offset,692 .offset = offset,
693 .addend = 0,693 .addend = 0,
...@@ -906,7 +906,7 @@ fn mirLoadMemoryPie(emit: *Emit, inst: Mir.Inst.Index) !void {...@@ -906,7 +906,7 @@ fn mirLoadMemoryPie(emit: *Emit, inst: Mir.Inst.Index) !void {
906 .addend = 0,906 .addend = 0,
907 .pcrel = true,907 .pcrel = true,
908 .length = 2,908 .length = 2,
909 .@"type" = switch (tag) {909 .type = switch (tag) {
910 .load_memory_got,910 .load_memory_got,
911 .load_memory_ptr_got,911 .load_memory_ptr_got,
912 => @enumToInt(std.macho.reloc_type_arm64.ARM64_RELOC_GOT_LOAD_PAGE21),912 => @enumToInt(std.macho.reloc_type_arm64.ARM64_RELOC_GOT_LOAD_PAGE21),
...@@ -922,7 +922,7 @@ fn mirLoadMemoryPie(emit: *Emit, inst: Mir.Inst.Index) !void {...@@ -922,7 +922,7 @@ fn mirLoadMemoryPie(emit: *Emit, inst: Mir.Inst.Index) !void {
922 .addend = 0,922 .addend = 0,
923 .pcrel = false,923 .pcrel = false,
924 .length = 2,924 .length = 2,
925 .@"type" = switch (tag) {925 .type = switch (tag) {
926 .load_memory_got,926 .load_memory_got,
927 .load_memory_ptr_got,927 .load_memory_ptr_got,
928 => @enumToInt(std.macho.reloc_type_arm64.ARM64_RELOC_GOT_LOAD_PAGEOFF12),928 => @enumToInt(std.macho.reloc_type_arm64.ARM64_RELOC_GOT_LOAD_PAGEOFF12),
...@@ -949,7 +949,7 @@ fn mirLoadMemoryPie(emit: *Emit, inst: Mir.Inst.Index) !void {...@@ -949,7 +949,7 @@ fn mirLoadMemoryPie(emit: *Emit, inst: Mir.Inst.Index) !void {
949 .addend = 0,949 .addend = 0,
950 .pcrel = true,950 .pcrel = true,
951 .length = 2,951 .length = 2,
952 .@"type" = switch (tag) {952 .type = switch (tag) {
953 .load_memory_got,953 .load_memory_got,
954 .load_memory_ptr_got,954 .load_memory_ptr_got,
955 => .got_page,955 => .got_page,
...@@ -966,7 +966,7 @@ fn mirLoadMemoryPie(emit: *Emit, inst: Mir.Inst.Index) !void {...@@ -966,7 +966,7 @@ fn mirLoadMemoryPie(emit: *Emit, inst: Mir.Inst.Index) !void {
966 .addend = 0,966 .addend = 0,
967 .pcrel = false,967 .pcrel = false,
968 .length = 2,968 .length = 2,
969 .@"type" = switch (tag) {969 .type = switch (tag) {
970 .load_memory_got,970 .load_memory_got,
971 .load_memory_ptr_got,971 .load_memory_ptr_got,
972 => .got_pageoff,972 => .got_pageoff,
src/arch/sparc64/CodeGen.zig+1-1
...@@ -446,7 +446,7 @@ fn gen(self: *Self) !void {...@@ -446,7 +446,7 @@ fn gen(self: *Self) !void {
446 .data = .{446 .data = .{
447 .arithmetic_2op = .{447 .arithmetic_2op = .{
448 .is_imm = true,448 .is_imm = true,
449 .rs1 = .@"i7",449 .rs1 = .i7,
450 .rs2_or_imm = .{ .imm = 8 },450 .rs2_or_imm = .{ .imm = 8 },
451 },451 },
452 },452 },
src/arch/sparc64/bits.zig+10-10
...@@ -35,14 +35,14 @@ test "Register.id" {...@@ -35,14 +35,14 @@ test "Register.id" {
35 try testing.expectEqual(Register.o6.id(), Register.sp.id());35 try testing.expectEqual(Register.o6.id(), Register.sp.id());
3636
37 // FP37 // FP
38 try testing.expectEqual(@as(u5, 30), Register.@"i6".id());38 try testing.expectEqual(@as(u5, 30), Register.i6.id());
39 try testing.expectEqual(Register.@"i6".id(), Register.fp.id());39 try testing.expectEqual(Register.i6.id(), Register.fp.id());
4040
41 // x041 // x0
42 try testing.expectEqual(@as(u5, 0), Register.g0.id());42 try testing.expectEqual(@as(u5, 0), Register.g0.id());
43 try testing.expectEqual(@as(u5, 8), Register.o0.id());43 try testing.expectEqual(@as(u5, 8), Register.o0.id());
44 try testing.expectEqual(@as(u5, 16), Register.l0.id());44 try testing.expectEqual(@as(u5, 16), Register.l0.id());
45 try testing.expectEqual(@as(u5, 24), Register.@"i0".id());45 try testing.expectEqual(@as(u5, 24), Register.i0.id());
46}46}
4747
48test "Register.enc" {48test "Register.enc" {
...@@ -50,13 +50,13 @@ test "Register.enc" {...@@ -50,13 +50,13 @@ test "Register.enc" {
50 try testing.expectEqual(@as(u5, 0), Register.g0.enc());50 try testing.expectEqual(@as(u5, 0), Register.g0.enc());
51 try testing.expectEqual(@as(u5, 8), Register.o0.enc());51 try testing.expectEqual(@as(u5, 8), Register.o0.enc());
52 try testing.expectEqual(@as(u5, 16), Register.l0.enc());52 try testing.expectEqual(@as(u5, 16), Register.l0.enc());
53 try testing.expectEqual(@as(u5, 24), Register.@"i0".enc());53 try testing.expectEqual(@as(u5, 24), Register.i0.enc());
5454
55 // For integer registers, enc() == id().55 // For integer registers, enc() == id().
56 try testing.expectEqual(Register.g0.enc(), Register.g0.id());56 try testing.expectEqual(Register.g0.enc(), Register.g0.id());
57 try testing.expectEqual(Register.o0.enc(), Register.o0.id());57 try testing.expectEqual(Register.o0.enc(), Register.o0.id());
58 try testing.expectEqual(Register.l0.enc(), Register.l0.id());58 try testing.expectEqual(Register.l0.enc(), Register.l0.id());
59 try testing.expectEqual(Register.@"i0".enc(), Register.@"i0".id());59 try testing.expectEqual(Register.i0.enc(), Register.i0.id());
60}60}
6161
62/// Scalar floating point registers in the SPARCv9 instruction set62/// Scalar floating point registers in the SPARCv9 instruction set
...@@ -127,11 +127,11 @@ test "FloatingPointRegister.id" {...@@ -127,11 +127,11 @@ test "FloatingPointRegister.id" {
127 // Low region127 // Low region
128 try testing.expectEqual(@as(u6, 0), FloatingPointRegister.q0.id());128 try testing.expectEqual(@as(u6, 0), FloatingPointRegister.q0.id());
129 try testing.expectEqual(FloatingPointRegister.q0.id(), FloatingPointRegister.d0.id());129 try testing.expectEqual(FloatingPointRegister.q0.id(), FloatingPointRegister.d0.id());
130 try testing.expectEqual(FloatingPointRegister.d0.id(), FloatingPointRegister.@"f0".id());130 try testing.expectEqual(FloatingPointRegister.d0.id(), FloatingPointRegister.f0.id());
131131
132 try testing.expectEqual(@as(u6, 28), FloatingPointRegister.q28.id());132 try testing.expectEqual(@as(u6, 28), FloatingPointRegister.q28.id());
133 try testing.expectEqual(FloatingPointRegister.q28.id(), FloatingPointRegister.d28.id());133 try testing.expectEqual(FloatingPointRegister.q28.id(), FloatingPointRegister.d28.id());
134 try testing.expectEqual(FloatingPointRegister.d28.id(), FloatingPointRegister.@"f28".id());134 try testing.expectEqual(FloatingPointRegister.d28.id(), FloatingPointRegister.f28.id());
135135
136 // High region136 // High region
137 try testing.expectEqual(@as(u6, 32), FloatingPointRegister.q32.id());137 try testing.expectEqual(@as(u6, 32), FloatingPointRegister.q32.id());
...@@ -143,9 +143,9 @@ test "FloatingPointRegister.id" {...@@ -143,9 +143,9 @@ test "FloatingPointRegister.id" {
143143
144test "FloatingPointRegister.enc" {144test "FloatingPointRegister.enc" {
145 // f registers145 // f registers
146 try testing.expectEqual(@as(u5, 0), FloatingPointRegister.@"f0".enc());146 try testing.expectEqual(@as(u5, 0), FloatingPointRegister.f0.enc());
147 try testing.expectEqual(@as(u5, 1), FloatingPointRegister.@"f1".enc());147 try testing.expectEqual(@as(u5, 1), FloatingPointRegister.f1.enc());
148 try testing.expectEqual(@as(u5, 31), FloatingPointRegister.@"f31".enc());148 try testing.expectEqual(@as(u5, 31), FloatingPointRegister.f31.enc());
149149
150 // d registers150 // d registers
151 try testing.expectEqual(@as(u5, 0), FloatingPointRegister.d0.enc());151 try testing.expectEqual(@as(u5, 0), FloatingPointRegister.d0.enc());
src/arch/x86_64/CodeGen.zig+9-9
...@@ -132,7 +132,7 @@ pub const MCValue = union(enum) {...@@ -132,7 +132,7 @@ pub const MCValue = union(enum) {
132 /// * got - the value is referenced indirectly via GOT entry index (the linker emits a got-type reloc)132 /// * got - the value is referenced indirectly via GOT entry index (the linker emits a got-type reloc)
133 /// * direct - the value is referenced directly via symbol index index (the linker emits a displacement reloc)133 /// * direct - the value is referenced directly via symbol index index (the linker emits a displacement reloc)
134 /// * import - the value is referenced indirectly via import entry index (the linker emits an import-type reloc)134 /// * import - the value is referenced indirectly via import entry index (the linker emits an import-type reloc)
135 linker_load: struct { @"type": enum { got, direct, import }, sym_index: u32 },135 linker_load: struct { type: enum { got, direct, import }, sym_index: u32 },
136 /// The value is one of the stack variables.136 /// The value is one of the stack variables.
137 /// If the type is a pointer, it means the pointer address is in the stack at this offset.137 /// If the type is a pointer, it means the pointer address is in the stack at this offset.
138 stack_offset: i32,138 stack_offset: i32,
...@@ -2671,7 +2671,7 @@ fn loadMemPtrIntoRegister(self: *Self, reg: Register, ptr_ty: Type, ptr: MCValue...@@ -2671,7 +2671,7 @@ fn loadMemPtrIntoRegister(self: *Self, reg: Register, ptr_ty: Type, ptr: MCValue
2671 fn_owner_decl.link.macho.sym_index2671 fn_owner_decl.link.macho.sym_index
2672 else2672 else
2673 fn_owner_decl.link.coff.sym_index;2673 fn_owner_decl.link.coff.sym_index;
2674 const flags: u2 = switch (load_struct.@"type") {2674 const flags: u2 = switch (load_struct.type) {
2675 .got => 0b00,2675 .got => 0b00,
2676 .direct => 0b01,2676 .direct => 0b01,
2677 .import => 0b10,2677 .import => 0b10,
...@@ -4010,7 +4010,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions....@@ -4010,7 +4010,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.
4010 const fn_owner_decl = mod.declPtr(func.owner_decl);4010 const fn_owner_decl = mod.declPtr(func.owner_decl);
4011 try self.genSetReg(Type.initTag(.usize), .rax, .{4011 try self.genSetReg(Type.initTag(.usize), .rax, .{
4012 .linker_load = .{4012 .linker_load = .{
4013 .@"type" = .got,4013 .type = .got,
4014 .sym_index = fn_owner_decl.link.coff.sym_index,4014 .sym_index = fn_owner_decl.link.coff.sym_index,
4015 },4015 },
4016 });4016 });
...@@ -4034,7 +4034,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions....@@ -4034,7 +4034,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.
4034 const sym_index = try coff_file.getGlobalSymbol(mem.sliceTo(decl_name, 0));4034 const sym_index = try coff_file.getGlobalSymbol(mem.sliceTo(decl_name, 0));
4035 try self.genSetReg(Type.initTag(.usize), .rax, .{4035 try self.genSetReg(Type.initTag(.usize), .rax, .{
4036 .linker_load = .{4036 .linker_load = .{
4037 .@"type" = .import,4037 .type = .import,
4038 .sym_index = sym_index,4038 .sym_index = sym_index,
4039 },4039 },
4040 });4040 });
...@@ -4070,7 +4070,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions....@@ -4070,7 +4070,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.
4070 const sym_index = fn_owner_decl.link.macho.sym_index;4070 const sym_index = fn_owner_decl.link.macho.sym_index;
4071 try self.genSetReg(Type.initTag(.usize), .rax, .{4071 try self.genSetReg(Type.initTag(.usize), .rax, .{
4072 .linker_load = .{4072 .linker_load = .{
4073 .@"type" = .got,4073 .type = .got,
4074 .sym_index = sym_index,4074 .sym_index = sym_index,
4075 },4075 },
4076 });4076 });
...@@ -6925,13 +6925,13 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl_index: Module.Decl.Index) Inne...@@ -6925,13 +6925,13 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl_index: Module.Decl.Index) Inne
6925 } else if (self.bin_file.cast(link.File.MachO)) |_| {6925 } else if (self.bin_file.cast(link.File.MachO)) |_| {
6926 assert(decl.link.macho.sym_index != 0);6926 assert(decl.link.macho.sym_index != 0);
6927 return MCValue{ .linker_load = .{6927 return MCValue{ .linker_load = .{
6928 .@"type" = .got,6928 .type = .got,
6929 .sym_index = decl.link.macho.sym_index,6929 .sym_index = decl.link.macho.sym_index,
6930 } };6930 } };
6931 } else if (self.bin_file.cast(link.File.Coff)) |_| {6931 } else if (self.bin_file.cast(link.File.Coff)) |_| {
6932 assert(decl.link.coff.sym_index != 0);6932 assert(decl.link.coff.sym_index != 0);
6933 return MCValue{ .linker_load = .{6933 return MCValue{ .linker_load = .{
6934 .@"type" = .got,6934 .type = .got,
6935 .sym_index = decl.link.coff.sym_index,6935 .sym_index = decl.link.coff.sym_index,
6936 } };6936 } };
6937 } else if (self.bin_file.cast(link.File.Plan9)) |p9| {6937 } else if (self.bin_file.cast(link.File.Plan9)) |p9| {
...@@ -6953,12 +6953,12 @@ fn lowerUnnamedConst(self: *Self, tv: TypedValue) InnerError!MCValue {...@@ -6953,12 +6953,12 @@ fn lowerUnnamedConst(self: *Self, tv: TypedValue) InnerError!MCValue {
6953 return MCValue{ .memory = vaddr };6953 return MCValue{ .memory = vaddr };
6954 } else if (self.bin_file.cast(link.File.MachO)) |_| {6954 } else if (self.bin_file.cast(link.File.MachO)) |_| {
6955 return MCValue{ .linker_load = .{6955 return MCValue{ .linker_load = .{
6956 .@"type" = .direct,6956 .type = .direct,
6957 .sym_index = local_sym_index,6957 .sym_index = local_sym_index,
6958 } };6958 } };
6959 } else if (self.bin_file.cast(link.File.Coff)) |_| {6959 } else if (self.bin_file.cast(link.File.Coff)) |_| {
6960 return MCValue{ .linker_load = .{6960 return MCValue{ .linker_load = .{
6961 .@"type" = .direct,6961 .type = .direct,
6962 .sym_index = local_sym_index,6962 .sym_index = local_sym_index,
6963 } };6963 } };
6964 } else if (self.bin_file.cast(link.File.Plan9)) |p9| {6964 } else if (self.bin_file.cast(link.File.Plan9)) |p9| {
src/arch/x86_64/Emit.zig+4-4
...@@ -1005,7 +1005,7 @@ fn mirLeaPic(emit: *Emit, inst: Mir.Inst.Index) InnerError!void {...@@ -1005,7 +1005,7 @@ fn mirLeaPic(emit: *Emit, inst: Mir.Inst.Index) InnerError!void {
1005 };1005 };
1006 const atom = macho_file.getAtomForSymbol(.{ .sym_index = relocation.atom_index, .file = null }).?;1006 const atom = macho_file.getAtomForSymbol(.{ .sym_index = relocation.atom_index, .file = null }).?;
1007 try atom.addRelocation(macho_file, .{1007 try atom.addRelocation(macho_file, .{
1008 .@"type" = reloc_type,1008 .type = reloc_type,
1009 .target = .{ .sym_index = relocation.sym_index, .file = null },1009 .target = .{ .sym_index = relocation.sym_index, .file = null },
1010 .offset = @intCast(u32, end_offset - 4),1010 .offset = @intCast(u32, end_offset - 4),
1011 .addend = 0,1011 .addend = 0,
...@@ -1015,7 +1015,7 @@ fn mirLeaPic(emit: *Emit, inst: Mir.Inst.Index) InnerError!void {...@@ -1015,7 +1015,7 @@ fn mirLeaPic(emit: *Emit, inst: Mir.Inst.Index) InnerError!void {
1015 } else if (emit.bin_file.cast(link.File.Coff)) |coff_file| {1015 } else if (emit.bin_file.cast(link.File.Coff)) |coff_file| {
1016 const atom = coff_file.getAtomForSymbol(.{ .sym_index = relocation.atom_index, .file = null }).?;1016 const atom = coff_file.getAtomForSymbol(.{ .sym_index = relocation.atom_index, .file = null }).?;
1017 try atom.addRelocation(coff_file, .{1017 try atom.addRelocation(coff_file, .{
1018 .@"type" = switch (ops.flags) {1018 .type = switch (ops.flags) {
1019 0b00 => .got,1019 0b00 => .got,
1020 0b01 => .direct,1020 0b01 => .direct,
1021 0b10 => .import,1021 0b10 => .import,
...@@ -1145,7 +1145,7 @@ fn mirCallExtern(emit: *Emit, inst: Mir.Inst.Index) InnerError!void {...@@ -1145,7 +1145,7 @@ fn mirCallExtern(emit: *Emit, inst: Mir.Inst.Index) InnerError!void {
1145 const atom = macho_file.getAtomForSymbol(.{ .sym_index = relocation.atom_index, .file = null }).?;1145 const atom = macho_file.getAtomForSymbol(.{ .sym_index = relocation.atom_index, .file = null }).?;
1146 const target = macho_file.getGlobalByIndex(relocation.sym_index);1146 const target = macho_file.getGlobalByIndex(relocation.sym_index);
1147 try atom.addRelocation(macho_file, .{1147 try atom.addRelocation(macho_file, .{
1148 .@"type" = @enumToInt(std.macho.reloc_type_x86_64.X86_64_RELOC_BRANCH),1148 .type = @enumToInt(std.macho.reloc_type_x86_64.X86_64_RELOC_BRANCH),
1149 .target = target,1149 .target = target,
1150 .offset = offset,1150 .offset = offset,
1151 .addend = 0,1151 .addend = 0,
...@@ -1157,7 +1157,7 @@ fn mirCallExtern(emit: *Emit, inst: Mir.Inst.Index) InnerError!void {...@@ -1157,7 +1157,7 @@ fn mirCallExtern(emit: *Emit, inst: Mir.Inst.Index) InnerError!void {
1157 const atom = coff_file.getAtomForSymbol(.{ .sym_index = relocation.atom_index, .file = null }).?;1157 const atom = coff_file.getAtomForSymbol(.{ .sym_index = relocation.atom_index, .file = null }).?;
1158 const target = coff_file.getGlobalByIndex(relocation.sym_index);1158 const target = coff_file.getGlobalByIndex(relocation.sym_index);
1159 try atom.addRelocation(coff_file, .{1159 try atom.addRelocation(coff_file, .{
1160 .@"type" = .direct,1160 .type = .direct,
1161 .target = target,1161 .target = target,
1162 .offset = offset,1162 .offset = offset,
1163 .addend = 0,1163 .addend = 0,
src/codegen/c.zig+10-10
...@@ -607,7 +607,7 @@ pub const DeclGen = struct {...@@ -607,7 +607,7 @@ pub const DeclGen = struct {
607 if (val.isUndefDeep()) {607 if (val.isUndefDeep()) {
608 switch (ty.zigTypeTag()) {608 switch (ty.zigTypeTag()) {
609 // bool b = 0xaa; evals to true, but memcpy(&b, 0xaa, 1); evals to false.609 // bool b = 0xaa; evals to true, but memcpy(&b, 0xaa, 1); evals to false.
610 .Bool => return dg.renderValue(writer, ty, Value.@"false", location),610 .Bool => return dg.renderValue(writer, ty, Value.false, location),
611 .Int, .Enum, .ErrorSet => return writer.print("{x}", .{try dg.fmtIntLiteral(ty, val)}),611 .Int, .Enum, .ErrorSet => return writer.print("{x}", .{try dg.fmtIntLiteral(ty, val)}),
612 .Float => {612 .Float => {
613 const bits = ty.floatBits(target);613 const bits = ty.floatBits(target);
...@@ -1964,7 +1964,7 @@ pub const DeclGen = struct {...@@ -1964,7 +1964,7 @@ pub const DeclGen = struct {
1964 try buffer.appendSlice(" }\n");1964 try buffer.appendSlice(" }\n");
1965 }1965 }
1966 try buffer.appendSlice(" }\n while (");1966 try buffer.appendSlice(" }\n while (");
1967 try dg.renderValue(bw, Type.bool, Value.@"true", .Other);1967 try dg.renderValue(bw, Type.bool, Value.true, .Other);
1968 try buffer.appendSlice(") ");1968 try buffer.appendSlice(") ");
1969 _ = try airBreakpoint(bw);1969 _ = try airBreakpoint(bw);
1970 try buffer.appendSlice("}\n");1970 try buffer.appendSlice("}\n");
...@@ -3800,7 +3800,7 @@ fn airLoop(f: *Function, inst: Air.Inst.Index) !CValue {...@@ -3800,7 +3800,7 @@ fn airLoop(f: *Function, inst: Air.Inst.Index) !CValue {
3800 const body = f.air.extra[loop.end..][0..loop.data.body_len];3800 const body = f.air.extra[loop.end..][0..loop.data.body_len];
3801 const writer = f.object.writer();3801 const writer = f.object.writer();
3802 try writer.writeAll("while (");3802 try writer.writeAll("while (");
3803 try f.object.dg.renderValue(writer, Type.bool, Value.@"true", .Other);3803 try f.object.dg.renderValue(writer, Type.bool, Value.true, .Other);
3804 try writer.writeAll(") ");3804 try writer.writeAll(") ");
3805 try genBody(f, body);3805 try genBody(f, body);
3806 try writer.writeByte('\n');3806 try writer.writeByte('\n');
...@@ -4095,19 +4095,19 @@ fn airIsNull(...@@ -4095,19 +4095,19 @@ fn airIsNull(
4095 var slice_ptr_buf: Type.SlicePtrFieldTypeBuffer = undefined;4095 var slice_ptr_buf: Type.SlicePtrFieldTypeBuffer = undefined;
40964096
4097 const rhs = if (!payload_ty.hasRuntimeBitsIgnoreComptime())4097 const rhs = if (!payload_ty.hasRuntimeBitsIgnoreComptime())
4098 TypedValue{ .ty = Type.bool, .val = Value.@"true" }4098 TypedValue{ .ty = Type.bool, .val = Value.true }
4099 else if (optional_ty.isPtrLikeOptional())4099 else if (optional_ty.isPtrLikeOptional())
4100 // operand is a regular pointer, test `operand !=/== NULL`4100 // operand is a regular pointer, test `operand !=/== NULL`
4101 TypedValue{ .ty = optional_ty, .val = Value.@"null" }4101 TypedValue{ .ty = optional_ty, .val = Value.null }
4102 else if (payload_ty.zigTypeTag() == .ErrorSet)4102 else if (payload_ty.zigTypeTag() == .ErrorSet)
4103 TypedValue{ .ty = payload_ty, .val = Value.zero }4103 TypedValue{ .ty = payload_ty, .val = Value.zero }
4104 else if (payload_ty.isSlice() and optional_ty.optionalReprIsPayload()) rhs: {4104 else if (payload_ty.isSlice() and optional_ty.optionalReprIsPayload()) rhs: {
4105 try writer.writeAll(".ptr");4105 try writer.writeAll(".ptr");
4106 const slice_ptr_ty = payload_ty.slicePtrFieldType(&slice_ptr_buf);4106 const slice_ptr_ty = payload_ty.slicePtrFieldType(&slice_ptr_buf);
4107 break :rhs TypedValue{ .ty = slice_ptr_ty, .val = Value.@"null" };4107 break :rhs TypedValue{ .ty = slice_ptr_ty, .val = Value.null };
4108 } else rhs: {4108 } else rhs: {
4109 try writer.writeAll(".is_null");4109 try writer.writeAll(".is_null");
4110 break :rhs TypedValue{ .ty = Type.bool, .val = Value.@"true" };4110 break :rhs TypedValue{ .ty = Type.bool, .val = Value.true };
4111 };4111 };
4112 try writer.writeByte(' ');4112 try writer.writeByte(' ');
4113 try writer.writeAll(operator);4113 try writer.writeAll(operator);
...@@ -4195,7 +4195,7 @@ fn airOptionalPayloadPtrSet(f: *Function, inst: Air.Inst.Index) !CValue {...@@ -4195,7 +4195,7 @@ fn airOptionalPayloadPtrSet(f: *Function, inst: Air.Inst.Index) !CValue {
41954195
4196 try f.writeCValueDeref(writer, operand);4196 try f.writeCValueDeref(writer, operand);
4197 try writer.writeAll(".is_null = ");4197 try writer.writeAll(".is_null = ");
4198 try f.object.dg.renderValue(writer, Type.bool, Value.@"false", .Initializer);4198 try f.object.dg.renderValue(writer, Type.bool, Value.false, .Initializer);
4199 try writer.writeAll(";\n");4199 try writer.writeAll(";\n");
42004200
4201 const inst_ty = f.air.typeOfIndex(inst);4201 const inst_ty = f.air.typeOfIndex(inst);
...@@ -4534,7 +4534,7 @@ fn airWrapOptional(f: *Function, inst: Air.Inst.Index) !CValue {...@@ -4534,7 +4534,7 @@ fn airWrapOptional(f: *Function, inst: Air.Inst.Index) !CValue {
4534 try writer.writeAll(" = { .payload = ");4534 try writer.writeAll(" = { .payload = ");
4535 try f.writeCValue(writer, if (is_array) CValue{ .undef = payload_ty } else payload, .Initializer);4535 try f.writeCValue(writer, if (is_array) CValue{ .undef = payload_ty } else payload, .Initializer);
4536 try writer.writeAll(", .is_null = ");4536 try writer.writeAll(", .is_null = ");
4537 try f.object.dg.renderValue(writer, Type.bool, Value.@"false", .Initializer);4537 try f.object.dg.renderValue(writer, Type.bool, Value.false, .Initializer);
4538 try writer.writeAll(" };\n");4538 try writer.writeAll(" };\n");
4539 if (is_array) {4539 if (is_array) {
4540 try writer.writeAll("memcpy(");4540 try writer.writeAll("memcpy(");
...@@ -4862,7 +4862,7 @@ fn airCmpxchg(f: *Function, inst: Air.Inst.Index, flavor: [*:0]const u8) !CValue...@@ -4862,7 +4862,7 @@ fn airCmpxchg(f: *Function, inst: Air.Inst.Index, flavor: [*:0]const u8) !CValue
4862 try f.writeCValue(writer, expected_value, .Initializer);4862 try f.writeCValue(writer, expected_value, .Initializer);
4863 if (is_struct) {4863 if (is_struct) {
4864 try writer.writeAll(", .is_null = ");4864 try writer.writeAll(", .is_null = ");
4865 try f.object.dg.renderValue(writer, Type.bool, Value.@"false", .Initializer);4865 try f.object.dg.renderValue(writer, Type.bool, Value.false, .Initializer);
4866 try writer.writeAll(" }");4866 try writer.writeAll(" }");
4867 }4867 }
4868 try writer.writeAll(";\n");4868 try writer.writeAll(";\n");
src/codegen/llvm.zig+1-1
...@@ -10723,7 +10723,7 @@ fn ccAbiPromoteInt(...@@ -10723,7 +10723,7 @@ fn ccAbiPromoteInt(
10723 else => {},10723 else => {},
10724 }10724 }
10725 const int_info = switch (ty.zigTypeTag()) {10725 const int_info = switch (ty.zigTypeTag()) {
10726 .Bool => Type.@"u1".intInfo(target),10726 .Bool => Type.u1.intInfo(target),
10727 .Int, .Enum, .ErrorSet => ty.intInfo(target),10727 .Int, .Enum, .ErrorSet => ty.intInfo(target),
10728 else => return null,10728 else => return null,
10729 };10729 };
src/codegen/spirv/type.zig+1-1
...@@ -104,7 +104,7 @@ pub const Type = extern union {...@@ -104,7 +104,7 @@ pub const Type = extern union {
104 }104 }
105 return true;105 return true;
106 },106 },
107 .@"function" => {107 .function => {
108 const fn_a = a.payload(.function);108 const fn_a = a.payload(.function);
109 const fn_b = b.payload(.function);109 const fn_b = b.payload(.function);
110 if (fn_a.return_type != fn_b.return_type)110 if (fn_a.return_type != fn_b.return_type)
src/link/Coff.zig+10-10
...@@ -337,7 +337,7 @@ fn populateMissingMetadata(self: *Coff) !void {...@@ -337,7 +337,7 @@ fn populateMissingMetadata(self: *Coff) !void {
337 .name = [_]u8{0} ** 8,337 .name = [_]u8{0} ** 8,
338 .value = 0,338 .value = 0,
339 .section_number = .UNDEFINED,339 .section_number = .UNDEFINED,
340 .@"type" = .{ .base_type = .NULL, .complex_type = .NULL },340 .type = .{ .base_type = .NULL, .complex_type = .NULL },
341 .storage_class = .NULL,341 .storage_class = .NULL,
342 .number_of_aux_symbols = 0,342 .number_of_aux_symbols = 0,
343 });343 });
...@@ -635,7 +635,7 @@ fn allocateSymbol(self: *Coff) !u32 {...@@ -635,7 +635,7 @@ fn allocateSymbol(self: *Coff) !u32 {
635 .name = [_]u8{0} ** 8,635 .name = [_]u8{0} ** 8,
636 .value = 0,636 .value = 0,
637 .section_number = .UNDEFINED,637 .section_number = .UNDEFINED,
638 .@"type" = .{ .base_type = .NULL, .complex_type = .NULL },638 .type = .{ .base_type = .NULL, .complex_type = .NULL },
639 .storage_class = .NULL,639 .storage_class = .NULL,
640 .number_of_aux_symbols = 0,640 .number_of_aux_symbols = 0,
641 };641 };
...@@ -730,7 +730,7 @@ fn createGotAtom(self: *Coff, target: SymbolWithLoc) !*Atom {...@@ -730,7 +730,7 @@ fn createGotAtom(self: *Coff, target: SymbolWithLoc) !*Atom {
730 log.debug("allocated GOT atom at 0x{x}", .{sym.value});730 log.debug("allocated GOT atom at 0x{x}", .{sym.value});
731731
732 try atom.addRelocation(self, .{732 try atom.addRelocation(self, .{
733 .@"type" = .direct,733 .type = .direct,
734 .target = target,734 .target = target,
735 .offset = 0,735 .offset = 0,
736 .addend = 0,736 .addend = 0,
...@@ -1106,7 +1106,7 @@ fn updateDeclCode(self: *Coff, decl_index: Module.Decl.Index, code: []const u8,...@@ -1106,7 +1106,7 @@ fn updateDeclCode(self: *Coff, decl_index: Module.Decl.Index, code: []const u8,
1106 const sym = atom.getSymbolPtr(self);1106 const sym = atom.getSymbolPtr(self);
1107 try self.setSymbolName(sym, decl_name);1107 try self.setSymbolName(sym, decl_name);
1108 sym.section_number = @intToEnum(coff.SectionNumber, sect_index + 1);1108 sym.section_number = @intToEnum(coff.SectionNumber, sect_index + 1);
1109 sym.@"type" = .{ .complex_type = complex_type, .base_type = .NULL };1109 sym.type = .{ .complex_type = complex_type, .base_type = .NULL };
11101110
1111 const capacity = atom.capacity(self);1111 const capacity = atom.capacity(self);
1112 const need_realloc = code.len > capacity or !mem.isAlignedGeneric(u64, sym.value, required_alignment);1112 const need_realloc = code.len > capacity or !mem.isAlignedGeneric(u64, sym.value, required_alignment);
...@@ -1131,7 +1131,7 @@ fn updateDeclCode(self: *Coff, decl_index: Module.Decl.Index, code: []const u8,...@@ -1131,7 +1131,7 @@ fn updateDeclCode(self: *Coff, decl_index: Module.Decl.Index, code: []const u8,
1131 const sym = atom.getSymbolPtr(self);1131 const sym = atom.getSymbolPtr(self);
1132 try self.setSymbolName(sym, decl_name);1132 try self.setSymbolName(sym, decl_name);
1133 sym.section_number = @intToEnum(coff.SectionNumber, sect_index + 1);1133 sym.section_number = @intToEnum(coff.SectionNumber, sect_index + 1);
1134 sym.@"type" = .{ .complex_type = complex_type, .base_type = .NULL };1134 sym.type = .{ .complex_type = complex_type, .base_type = .NULL };
11351135
1136 const vaddr = try self.allocateAtom(atom, code_len, required_alignment);1136 const vaddr = try self.allocateAtom(atom, code_len, required_alignment);
1137 errdefer self.freeAtom(atom);1137 errdefer self.freeAtom(atom);
...@@ -1307,7 +1307,7 @@ pub fn updateDeclExports(...@@ -1307,7 +1307,7 @@ pub fn updateDeclExports(
1307 try self.setSymbolName(sym, exp.options.name);1307 try self.setSymbolName(sym, exp.options.name);
1308 sym.value = decl_sym.value;1308 sym.value = decl_sym.value;
1309 sym.section_number = @intToEnum(coff.SectionNumber, self.text_section_index.? + 1);1309 sym.section_number = @intToEnum(coff.SectionNumber, self.text_section_index.? + 1);
1310 sym.@"type" = .{ .complex_type = .FUNCTION, .base_type = .NULL };1310 sym.type = .{ .complex_type = .FUNCTION, .base_type = .NULL };
13111311
1312 switch (exp.options.linkage) {1312 switch (exp.options.linkage) {
1313 .Strong => {1313 .Strong => {
...@@ -1337,7 +1337,7 @@ pub fn deleteExport(self: *Coff, exp: Export) void {...@@ -1337,7 +1337,7 @@ pub fn deleteExport(self: *Coff, exp: Export) void {
1337 .name = [_]u8{0} ** 8,1337 .name = [_]u8{0} ** 8,
1338 .value = 0,1338 .value = 0,
1339 .section_number = .UNDEFINED,1339 .section_number = .UNDEFINED,
1340 .@"type" = .{ .base_type = .NULL, .complex_type = .NULL },1340 .type = .{ .base_type = .NULL, .complex_type = .NULL },
1341 .storage_class = .NULL,1341 .storage_class = .NULL,
1342 .number_of_aux_symbols = 0,1342 .number_of_aux_symbols = 0,
1343 };1343 };
...@@ -1465,7 +1465,7 @@ pub fn getDeclVAddr(...@@ -1465,7 +1465,7 @@ pub fn getDeclVAddr(
1465 const atom = self.getAtomForSymbol(.{ .sym_index = reloc_info.parent_atom_index, .file = null }).?;1465 const atom = self.getAtomForSymbol(.{ .sym_index = reloc_info.parent_atom_index, .file = null }).?;
1466 const target = SymbolWithLoc{ .sym_index = decl.link.coff.sym_index, .file = null };1466 const target = SymbolWithLoc{ .sym_index = decl.link.coff.sym_index, .file = null };
1467 try atom.addRelocation(self, .{1467 try atom.addRelocation(self, .{
1468 .@"type" = .direct,1468 .type = .direct,
1469 .target = target,1469 .target = target,
1470 .offset = @intCast(u32, reloc_info.offset),1470 .offset = @intCast(u32, reloc_info.offset),
1471 .addend = reloc_info.addend,1471 .addend = reloc_info.addend,
...@@ -1537,7 +1537,7 @@ fn writeBaseRelocations(self: *Coff) !void {...@@ -1537,7 +1537,7 @@ fn writeBaseRelocations(self: *Coff) !void {
1537 }1537 }
1538 try gop.value_ptr.append(.{1538 try gop.value_ptr.append(.{
1539 .offset = @intCast(u12, rva - page),1539 .offset = @intCast(u12, rva - page),
1540 .@"type" = .DIR64,1540 .type = .DIR64,
1541 });1541 });
1542 }1542 }
1543 }1543 }
...@@ -1555,7 +1555,7 @@ fn writeBaseRelocations(self: *Coff) !void {...@@ -1555,7 +1555,7 @@ fn writeBaseRelocations(self: *Coff) !void {
1555 )) {1555 )) {
1556 try entry.value_ptr.append(.{1556 try entry.value_ptr.append(.{
1557 .offset = 0,1557 .offset = 0,
1558 .@"type" = .ABSOLUTE,1558 .type = .ABSOLUTE,
1559 });1559 });
1560 }1560 }
15611561
src/link/Coff/Atom.zig+1-1
...@@ -94,7 +94,7 @@ pub fn freeListEligible(self: Atom, coff_file: *const Coff) bool {...@@ -94,7 +94,7 @@ pub fn freeListEligible(self: Atom, coff_file: *const Coff) bool {
9494
95pub fn addRelocation(self: *Atom, coff_file: *Coff, reloc: Relocation) !void {95pub fn addRelocation(self: *Atom, coff_file: *Coff, reloc: Relocation) !void {
96 const gpa = coff_file.base.allocator;96 const gpa = coff_file.base.allocator;
97 log.debug(" (adding reloc of type {s} to target %{d})", .{ @tagName(reloc.@"type"), reloc.target.sym_index });97 log.debug(" (adding reloc of type {s} to target %{d})", .{ @tagName(reloc.type), reloc.target.sym_index });
98 const gop = try coff_file.relocs.getOrPut(gpa, self);98 const gop = try coff_file.relocs.getOrPut(gpa, self);
99 if (!gop.found_existing) {99 if (!gop.found_existing) {
100 gop.value_ptr.* = .{};100 gop.value_ptr.* = .{};
src/link/Coff/Relocation.zig+5-5
...@@ -13,7 +13,7 @@ const Atom = @import("Atom.zig");...@@ -13,7 +13,7 @@ const Atom = @import("Atom.zig");
13const Coff = @import("../Coff.zig");13const Coff = @import("../Coff.zig");
14const SymbolWithLoc = Coff.SymbolWithLoc;14const SymbolWithLoc = Coff.SymbolWithLoc;
1515
16@"type": enum {16type: enum {
17 // x86, x86_6417 // x86, x86_64
18 /// RIP-relative displacement to a GOT pointer18 /// RIP-relative displacement to a GOT pointer
19 got,19 got,
...@@ -47,7 +47,7 @@ dirty: bool = true,...@@ -47,7 +47,7 @@ dirty: bool = true,
4747
48/// Returns an Atom which is the target node of this relocation edge (if any).48/// Returns an Atom which is the target node of this relocation edge (if any).
49pub fn getTargetAtom(self: Relocation, coff_file: *Coff) ?*Atom {49pub fn getTargetAtom(self: Relocation, coff_file: *Coff) ?*Atom {
50 switch (self.@"type") {50 switch (self.type) {
51 .got,51 .got,
52 .got_page,52 .got_page,
53 .got_pageoff,53 .got_pageoff,
...@@ -80,7 +80,7 @@ pub fn resolve(self: *Relocation, atom: *Atom, coff_file: *Coff) !void {...@@ -80,7 +80,7 @@ pub fn resolve(self: *Relocation, atom: *Atom, coff_file: *Coff) !void {
80 source_vaddr,80 source_vaddr,
81 target_vaddr_with_addend,81 target_vaddr_with_addend,
82 coff_file.getSymbolName(self.target),82 coff_file.getSymbolName(self.target),
83 @tagName(self.@"type"),83 @tagName(self.type),
84 file_offset + self.offset,84 file_offset + self.offset,
85 });85 });
8686
...@@ -121,7 +121,7 @@ fn resolveAarch64(self: *Relocation, ctx: Context, coff_file: *Coff) !void {...@@ -121,7 +121,7 @@ fn resolveAarch64(self: *Relocation, ctx: Context, coff_file: *Coff) !void {
121 else => unreachable,121 else => unreachable,
122 }122 }
123123
124 switch (self.@"type") {124 switch (self.type) {
125 .got_page, .import_page, .page => {125 .got_page, .import_page, .page => {
126 const source_page = @intCast(i32, ctx.source_vaddr >> 12);126 const source_page = @intCast(i32, ctx.source_vaddr >> 12);
127 const target_page = @intCast(i32, ctx.target_vaddr >> 12);127 const target_page = @intCast(i32, ctx.target_vaddr >> 12);
...@@ -198,7 +198,7 @@ fn resolveAarch64(self: *Relocation, ctx: Context, coff_file: *Coff) !void {...@@ -198,7 +198,7 @@ fn resolveAarch64(self: *Relocation, ctx: Context, coff_file: *Coff) !void {
198}198}
199199
200fn resolveX86(self: *Relocation, ctx: Context, coff_file: *Coff) !void {200fn resolveX86(self: *Relocation, ctx: Context, coff_file: *Coff) !void {
201 switch (self.@"type") {201 switch (self.type) {
202 .got_page => unreachable,202 .got_page => unreachable,
203 .got_pageoff => unreachable,203 .got_pageoff => unreachable,
204 .page => unreachable,204 .page => unreachable,
src/link/Dwarf.zig+7-7
...@@ -104,7 +104,7 @@ pub const DeclState = struct {...@@ -104,7 +104,7 @@ pub const DeclState = struct {
104 pub fn addExprlocReloc(self: *DeclState, target: u32, offset: u32, is_ptr: bool) !void {104 pub fn addExprlocReloc(self: *DeclState, target: u32, offset: u32, is_ptr: bool) !void {
105 log.debug("{x}: target sym %{d}, via GOT {}", .{ offset, target, is_ptr });105 log.debug("{x}: target sym %{d}, via GOT {}", .{ offset, target, is_ptr });
106 try self.exprloc_relocs.append(self.gpa, .{106 try self.exprloc_relocs.append(self.gpa, .{
107 .@"type" = if (is_ptr) .got_load else .direct_load,107 .type = if (is_ptr) .got_load else .direct_load,
108 .target = target,108 .target = target,
109 .offset = offset,109 .offset = offset,
110 });110 });
...@@ -132,7 +132,7 @@ pub const DeclState = struct {...@@ -132,7 +132,7 @@ pub const DeclState = struct {
132 const sym_index = @intCast(u32, self.abbrev_table.items.len);132 const sym_index = @intCast(u32, self.abbrev_table.items.len);
133 try self.abbrev_table.append(self.gpa, .{133 try self.abbrev_table.append(self.gpa, .{
134 .atom = atom,134 .atom = atom,
135 .@"type" = ty,135 .type = ty,
136 .offset = undefined,136 .offset = undefined,
137 });137 });
138 log.debug("%{d}: {}", .{ sym_index, ty.fmtDebug() });138 log.debug("%{d}: {}", .{ sym_index, ty.fmtDebug() });
...@@ -564,7 +564,7 @@ pub const DeclState = struct {...@@ -564,7 +564,7 @@ pub const DeclState = struct {
564564
565pub const AbbrevEntry = struct {565pub const AbbrevEntry = struct {
566 atom: *const Atom,566 atom: *const Atom,
567 @"type": Type,567 type: Type,
568 offset: u32,568 offset: u32,
569};569};
570570
...@@ -579,7 +579,7 @@ pub const AbbrevRelocation = struct {...@@ -579,7 +579,7 @@ pub const AbbrevRelocation = struct {
579579
580pub const ExprlocRelocation = struct {580pub const ExprlocRelocation = struct {
581 /// Type of the relocation: direct load ref, or GOT load ref (via GOT table)581 /// Type of the relocation: direct load ref, or GOT load ref (via GOT table)
582 @"type": enum {582 type: enum {
583 direct_load,583 direct_load,
584 got_load,584 got_load,
585 },585 },
...@@ -1022,7 +1022,7 @@ pub fn commitDeclState(...@@ -1022,7 +1022,7 @@ pub fn commitDeclState(
1022 var sym_index: usize = 0;1022 var sym_index: usize = 0;
1023 while (sym_index < decl_state.abbrev_table.items.len) : (sym_index += 1) {1023 while (sym_index < decl_state.abbrev_table.items.len) : (sym_index += 1) {
1024 const symbol = &decl_state.abbrev_table.items[sym_index];1024 const symbol = &decl_state.abbrev_table.items[sym_index];
1025 const ty = symbol.@"type";1025 const ty = symbol.type;
1026 const deferred: bool = blk: {1026 const deferred: bool = blk: {
1027 if (ty.isAnyError()) break :blk true;1027 if (ty.isAnyError()) break :blk true;
1028 switch (ty.tag()) {1028 switch (ty.tag()) {
...@@ -1046,7 +1046,7 @@ pub fn commitDeclState(...@@ -1046,7 +1046,7 @@ pub fn commitDeclState(
1046 while (decl_state.abbrev_relocs.popOrNull()) |reloc| {1046 while (decl_state.abbrev_relocs.popOrNull()) |reloc| {
1047 if (reloc.target) |target| {1047 if (reloc.target) |target| {
1048 const symbol = decl_state.abbrev_table.items[target];1048 const symbol = decl_state.abbrev_table.items[target];
1049 const ty = symbol.@"type";1049 const ty = symbol.type;
1050 const deferred: bool = blk: {1050 const deferred: bool = blk: {
1051 if (ty.isAnyError()) break :blk true;1051 if (ty.isAnyError()) break :blk true;
1052 switch (ty.tag()) {1052 switch (ty.tag()) {
...@@ -1091,7 +1091,7 @@ pub fn commitDeclState(...@@ -1091,7 +1091,7 @@ pub fn commitDeclState(
1091 const macho_file = file.cast(File.MachO).?;1091 const macho_file = file.cast(File.MachO).?;
1092 const d_sym = &macho_file.d_sym.?;1092 const d_sym = &macho_file.d_sym.?;
1093 try d_sym.relocs.append(d_sym.base.base.allocator, .{1093 try d_sym.relocs.append(d_sym.base.base.allocator, .{
1094 .@"type" = switch (reloc.@"type") {1094 .type = switch (reloc.type) {
1095 .direct_load => .direct_load,1095 .direct_load => .direct_load,
1096 .got_load => .got_load,1096 .got_load => .got_load,
1097 },1097 },
src/link/MachO.zig+17-17
...@@ -1059,7 +1059,7 @@ pub fn createGotAtom(self: *MachO, target: SymbolWithLoc) !*Atom {...@@ -1059,7 +1059,7 @@ pub fn createGotAtom(self: *MachO, target: SymbolWithLoc) !*Atom {
1059 log.debug("allocated GOT atom at 0x{x}", .{sym.n_value});1059 log.debug("allocated GOT atom at 0x{x}", .{sym.n_value});
10601060
1061 try atom.addRelocation(self, .{1061 try atom.addRelocation(self, .{
1062 .@"type" = switch (self.base.options.target.cpu.arch) {1062 .type = switch (self.base.options.target.cpu.arch) {
1063 .aarch64 => @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_UNSIGNED),1063 .aarch64 => @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_UNSIGNED),
1064 .x86_64 => @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_UNSIGNED),1064 .x86_64 => @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_UNSIGNED),
1065 else => unreachable,1065 else => unreachable,
...@@ -1164,14 +1164,14 @@ pub fn createStubHelperPreambleAtom(self: *MachO) !void {...@@ -1164,14 +1164,14 @@ pub fn createStubHelperPreambleAtom(self: *MachO) !void {
1164 code[10] = 0x25;1164 code[10] = 0x25;
11651165
1166 try atom.addRelocations(self, 2, .{ .{1166 try atom.addRelocations(self, 2, .{ .{
1167 .@"type" = @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_SIGNED),1167 .type = @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_SIGNED),
1168 .target = .{ .sym_index = dyld_private_sym_index, .file = null },1168 .target = .{ .sym_index = dyld_private_sym_index, .file = null },
1169 .offset = 3,1169 .offset = 3,
1170 .addend = 0,1170 .addend = 0,
1171 .pcrel = true,1171 .pcrel = true,
1172 .length = 2,1172 .length = 2,
1173 }, .{1173 }, .{
1174 .@"type" = @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_GOT),1174 .type = @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_GOT),
1175 .target = .{ .sym_index = self.dyld_stub_binder_index.?, .file = null },1175 .target = .{ .sym_index = self.dyld_stub_binder_index.?, .file = null },
1176 .offset = 11,1176 .offset = 11,
1177 .addend = 0,1177 .addend = 0,
...@@ -1204,28 +1204,28 @@ pub fn createStubHelperPreambleAtom(self: *MachO) !void {...@@ -1204,28 +1204,28 @@ pub fn createStubHelperPreambleAtom(self: *MachO) !void {
1204 mem.writeIntLittle(u32, code[20..][0..4], aarch64.Instruction.br(.x16).toU32());1204 mem.writeIntLittle(u32, code[20..][0..4], aarch64.Instruction.br(.x16).toU32());
12051205
1206 try atom.addRelocations(self, 4, .{ .{1206 try atom.addRelocations(self, 4, .{ .{
1207 .@"type" = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_PAGE21),1207 .type = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_PAGE21),
1208 .target = .{ .sym_index = dyld_private_sym_index, .file = null },1208 .target = .{ .sym_index = dyld_private_sym_index, .file = null },
1209 .offset = 0,1209 .offset = 0,
1210 .addend = 0,1210 .addend = 0,
1211 .pcrel = true,1211 .pcrel = true,
1212 .length = 2,1212 .length = 2,
1213 }, .{1213 }, .{
1214 .@"type" = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_PAGEOFF12),1214 .type = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_PAGEOFF12),
1215 .target = .{ .sym_index = dyld_private_sym_index, .file = null },1215 .target = .{ .sym_index = dyld_private_sym_index, .file = null },
1216 .offset = 4,1216 .offset = 4,
1217 .addend = 0,1217 .addend = 0,
1218 .pcrel = false,1218 .pcrel = false,
1219 .length = 2,1219 .length = 2,
1220 }, .{1220 }, .{
1221 .@"type" = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_GOT_LOAD_PAGE21),1221 .type = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_GOT_LOAD_PAGE21),
1222 .target = .{ .sym_index = self.dyld_stub_binder_index.?, .file = null },1222 .target = .{ .sym_index = self.dyld_stub_binder_index.?, .file = null },
1223 .offset = 12,1223 .offset = 12,
1224 .addend = 0,1224 .addend = 0,
1225 .pcrel = true,1225 .pcrel = true,
1226 .length = 2,1226 .length = 2,
1227 }, .{1227 }, .{
1228 .@"type" = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_GOT_LOAD_PAGEOFF12),1228 .type = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_GOT_LOAD_PAGEOFF12),
1229 .target = .{ .sym_index = self.dyld_stub_binder_index.?, .file = null },1229 .target = .{ .sym_index = self.dyld_stub_binder_index.?, .file = null },
1230 .offset = 16,1230 .offset = 16,
1231 .addend = 0,1231 .addend = 0,
...@@ -1286,7 +1286,7 @@ pub fn createStubHelperAtom(self: *MachO) !*Atom {...@@ -1286,7 +1286,7 @@ pub fn createStubHelperAtom(self: *MachO) !*Atom {
1286 code[5] = 0xe9;1286 code[5] = 0xe9;
12871287
1288 try atom.addRelocation(self, .{1288 try atom.addRelocation(self, .{
1289 .@"type" = @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_BRANCH),1289 .type = @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_BRANCH),
1290 .target = .{ .sym_index = self.stub_helper_preamble_atom.?.sym_index, .file = null },1290 .target = .{ .sym_index = self.stub_helper_preamble_atom.?.sym_index, .file = null },
1291 .offset = 6,1291 .offset = 6,
1292 .addend = 0,1292 .addend = 0,
...@@ -1309,7 +1309,7 @@ pub fn createStubHelperAtom(self: *MachO) !*Atom {...@@ -1309,7 +1309,7 @@ pub fn createStubHelperAtom(self: *MachO) !*Atom {
1309 // Next 4 bytes 8..12 are just a placeholder populated in `populateLazyBindOffsetsInStubHelper`.1309 // Next 4 bytes 8..12 are just a placeholder populated in `populateLazyBindOffsetsInStubHelper`.
13101310
1311 try atom.addRelocation(self, .{1311 try atom.addRelocation(self, .{
1312 .@"type" = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_BRANCH26),1312 .type = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_BRANCH26),
1313 .target = .{ .sym_index = self.stub_helper_preamble_atom.?.sym_index, .file = null },1313 .target = .{ .sym_index = self.stub_helper_preamble_atom.?.sym_index, .file = null },
1314 .offset = 4,1314 .offset = 4,
1315 .addend = 0,1315 .addend = 0,
...@@ -1348,7 +1348,7 @@ pub fn createLazyPointerAtom(self: *MachO, stub_sym_index: u32, target: SymbolWi...@@ -1348,7 +1348,7 @@ pub fn createLazyPointerAtom(self: *MachO, stub_sym_index: u32, target: SymbolWi
1348 sym.n_sect = self.la_symbol_ptr_section_index.? + 1;1348 sym.n_sect = self.la_symbol_ptr_section_index.? + 1;
13491349
1350 try atom.addRelocation(self, .{1350 try atom.addRelocation(self, .{
1351 .@"type" = switch (self.base.options.target.cpu.arch) {1351 .type = switch (self.base.options.target.cpu.arch) {
1352 .aarch64 => @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_UNSIGNED),1352 .aarch64 => @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_UNSIGNED),
1353 .x86_64 => @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_UNSIGNED),1353 .x86_64 => @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_UNSIGNED),
1354 else => unreachable,1354 else => unreachable,
...@@ -1414,7 +1414,7 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !*Atom {...@@ -1414,7 +1414,7 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !*Atom {
1414 code[1] = 0x25;1414 code[1] = 0x25;
14151415
1416 try atom.addRelocation(self, .{1416 try atom.addRelocation(self, .{
1417 .@"type" = @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_BRANCH),1417 .type = @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_BRANCH),
1418 .target = .{ .sym_index = laptr_sym_index, .file = null },1418 .target = .{ .sym_index = laptr_sym_index, .file = null },
1419 .offset = 2,1419 .offset = 2,
1420 .addend = 0,1420 .addend = 0,
...@@ -1436,7 +1436,7 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !*Atom {...@@ -1436,7 +1436,7 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !*Atom {
14361436
1437 try atom.addRelocations(self, 2, .{1437 try atom.addRelocations(self, 2, .{
1438 .{1438 .{
1439 .@"type" = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_PAGE21),1439 .type = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_PAGE21),
1440 .target = .{ .sym_index = laptr_sym_index, .file = null },1440 .target = .{ .sym_index = laptr_sym_index, .file = null },
1441 .offset = 0,1441 .offset = 0,
1442 .addend = 0,1442 .addend = 0,
...@@ -1444,7 +1444,7 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !*Atom {...@@ -1444,7 +1444,7 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !*Atom {
1444 .length = 2,1444 .length = 2,
1445 },1445 },
1446 .{1446 .{
1447 .@"type" = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_PAGEOFF12),1447 .type = @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_PAGEOFF12),
1448 .target = .{ .sym_index = laptr_sym_index, .file = null },1448 .target = .{ .sym_index = laptr_sym_index, .file = null },
1449 .offset = 4,1449 .offset = 4,
1450 .addend = 0,1450 .addend = 0,
...@@ -2446,7 +2446,7 @@ pub fn getOutputSection(self: *MachO, sect: macho.section_64) !?u8 {...@@ -2446,7 +2446,7 @@ pub fn getOutputSection(self: *MachO, sect: macho.section_64) !?u8 {
2446 break :blk null;2446 break :blk null;
2447 }2447 }
24482448
2449 switch (sect.@"type"()) {2449 switch (sect.type()) {
2450 macho.S_4BYTE_LITERALS,2450 macho.S_4BYTE_LITERALS,
2451 macho.S_8BYTE_LITERALS,2451 macho.S_8BYTE_LITERALS,
2452 macho.S_16BYTE_LITERALS,2452 macho.S_16BYTE_LITERALS,
...@@ -2827,7 +2827,7 @@ pub fn getDeclVAddr(self: *MachO, decl_index: Module.Decl.Index, reloc_info: Fil...@@ -2827,7 +2827,7 @@ pub fn getDeclVAddr(self: *MachO, decl_index: Module.Decl.Index, reloc_info: Fil
28272827
2828 const atom = self.getAtomForSymbol(.{ .sym_index = reloc_info.parent_atom_index, .file = null }).?;2828 const atom = self.getAtomForSymbol(.{ .sym_index = reloc_info.parent_atom_index, .file = null }).?;
2829 try atom.addRelocation(self, .{2829 try atom.addRelocation(self, .{
2830 .@"type" = switch (self.base.options.target.cpu.arch) {2830 .type = switch (self.base.options.target.cpu.arch) {
2831 .aarch64 => @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_UNSIGNED),2831 .aarch64 => @enumToInt(macho.reloc_type_arm64.ARM64_RELOC_UNSIGNED),
2832 .x86_64 => @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_UNSIGNED),2832 .x86_64 => @enumToInt(macho.reloc_type_x86_64.X86_64_RELOC_UNSIGNED),
2833 else => unreachable,2833 else => unreachable,
...@@ -3345,10 +3345,10 @@ fn allocateAtom(self: *MachO, atom: *Atom, new_atom_size: u64, alignment: u64) !...@@ -3345,10 +3345,10 @@ fn allocateAtom(self: *MachO, atom: *Atom, new_atom_size: u64, alignment: u64) !
3345fn getSectionPrecedence(header: macho.section_64) u4 {3345fn getSectionPrecedence(header: macho.section_64) u4 {
3346 if (header.isCode()) {3346 if (header.isCode()) {
3347 if (mem.eql(u8, "__text", header.sectName())) return 0x0;3347 if (mem.eql(u8, "__text", header.sectName())) return 0x0;
3348 if (header.@"type"() == macho.S_SYMBOL_STUBS) return 0x1;3348 if (header.type() == macho.S_SYMBOL_STUBS) return 0x1;
3349 return 0x2;3349 return 0x2;
3350 }3350 }
3351 switch (header.@"type"()) {3351 switch (header.type()) {
3352 macho.S_NON_LAZY_SYMBOL_POINTERS,3352 macho.S_NON_LAZY_SYMBOL_POINTERS,
3353 macho.S_LAZY_SYMBOL_POINTERS,3353 macho.S_LAZY_SYMBOL_POINTERS,
3354 => return 0x0,3354 => return 0x0,
src/link/MachO/DebugSymbols.zig+3-3
...@@ -47,7 +47,7 @@ strtab: StringTable(.strtab) = .{},...@@ -47,7 +47,7 @@ strtab: StringTable(.strtab) = .{},
47relocs: std.ArrayListUnmanaged(Reloc) = .{},47relocs: std.ArrayListUnmanaged(Reloc) = .{},
4848
49pub const Reloc = struct {49pub const Reloc = struct {
50 @"type": enum {50 type: enum {
51 direct_load,51 direct_load,
52 got_load,52 got_load,
53 },53 },
...@@ -188,7 +188,7 @@ pub fn flushModule(self: *DebugSymbols, allocator: Allocator, options: link.Opti...@@ -188,7 +188,7 @@ pub fn flushModule(self: *DebugSymbols, allocator: Allocator, options: link.Opti
188 const module = options.module orelse return error.LinkingWithoutZigSourceUnimplemented;188 const module = options.module orelse return error.LinkingWithoutZigSourceUnimplemented;
189189
190 for (self.relocs.items) |*reloc| {190 for (self.relocs.items) |*reloc| {
191 const sym = switch (reloc.@"type") {191 const sym = switch (reloc.type) {
192 .direct_load => self.base.getSymbol(.{ .sym_index = reloc.target, .file = null }),192 .direct_load => self.base.getSymbol(.{ .sym_index = reloc.target, .file = null }),
193 .got_load => blk: {193 .got_load => blk: {
194 const got_index = self.base.got_entries_table.get(.{194 const got_index = self.base.got_entries_table.get(.{
...@@ -201,7 +201,7 @@ pub fn flushModule(self: *DebugSymbols, allocator: Allocator, options: link.Opti...@@ -201,7 +201,7 @@ pub fn flushModule(self: *DebugSymbols, allocator: Allocator, options: link.Opti
201 };201 };
202 if (sym.n_value == reloc.prev_vaddr) continue;202 if (sym.n_value == reloc.prev_vaddr) continue;
203203
204 const sym_name = switch (reloc.@"type") {204 const sym_name = switch (reloc.type) {
205 .direct_load => self.base.getSymbolName(.{ .sym_index = reloc.target, .file = null }),205 .direct_load => self.base.getSymbolName(.{ .sym_index = reloc.target, .file = null }),
206 .got_load => blk: {206 .got_load => blk: {
207 const got_index = self.base.got_entries_table.get(.{207 const got_index = self.base.got_entries_table.get(.{
src/link/MachO/DwarfInfo.zig+1-1
...@@ -185,7 +185,7 @@ const AbbrevEntryIterator = struct {...@@ -185,7 +185,7 @@ const AbbrevEntryIterator = struct {
185 self.pos += (math.cast(usize, creader.bytes_read) orelse return error.Overflow);185 self.pos += (math.cast(usize, creader.bytes_read) orelse return error.Overflow);
186186
187 if (kind == 0) {187 if (kind == 0) {
188 return AbbrevEntry.@"null"();188 return AbbrevEntry.null();
189 }189 }
190190
191 const abbrev_pos = lookup.get(kind) orelse return error.MalformedDwarf;191 const abbrev_pos = lookup.get(kind) orelse return error.MalformedDwarf;
src/link/MachO/Relocation.zig+7-7
...@@ -13,7 +13,7 @@ const Atom = @import("Atom.zig");...@@ -13,7 +13,7 @@ const Atom = @import("Atom.zig");
13const MachO = @import("../MachO.zig");13const MachO = @import("../MachO.zig");
14const SymbolWithLoc = MachO.SymbolWithLoc;14const SymbolWithLoc = MachO.SymbolWithLoc;
1515
16@"type": u4,16type: u4,
17target: SymbolWithLoc,17target: SymbolWithLoc,
18offset: u32,18offset: u32,
19addend: i64,19addend: i64,
...@@ -23,22 +23,22 @@ dirty: bool = true,...@@ -23,22 +23,22 @@ dirty: bool = true,
2323
24pub fn fmtType(self: Relocation, target: std.Target) []const u8 {24pub fn fmtType(self: Relocation, target: std.Target) []const u8 {
25 switch (target.cpu.arch) {25 switch (target.cpu.arch) {
26 .aarch64 => return @tagName(@intToEnum(macho.reloc_type_arm64, self.@"type")),26 .aarch64 => return @tagName(@intToEnum(macho.reloc_type_arm64, self.type)),
27 .x86_64 => return @tagName(@intToEnum(macho.reloc_type_x86_64, self.@"type")),27 .x86_64 => return @tagName(@intToEnum(macho.reloc_type_x86_64, self.type)),
28 else => unreachable,28 else => unreachable,
29 }29 }
30}30}
3131
32pub fn getTargetAtom(self: Relocation, macho_file: *MachO) ?*Atom {32pub fn getTargetAtom(self: Relocation, macho_file: *MachO) ?*Atom {
33 switch (macho_file.base.options.target.cpu.arch) {33 switch (macho_file.base.options.target.cpu.arch) {
34 .aarch64 => switch (@intToEnum(macho.reloc_type_arm64, self.@"type")) {34 .aarch64 => switch (@intToEnum(macho.reloc_type_arm64, self.type)) {
35 .ARM64_RELOC_GOT_LOAD_PAGE21,35 .ARM64_RELOC_GOT_LOAD_PAGE21,
36 .ARM64_RELOC_GOT_LOAD_PAGEOFF12,36 .ARM64_RELOC_GOT_LOAD_PAGEOFF12,
37 .ARM64_RELOC_POINTER_TO_GOT,37 .ARM64_RELOC_POINTER_TO_GOT,
38 => return macho_file.getGotAtomForSymbol(self.target),38 => return macho_file.getGotAtomForSymbol(self.target),
39 else => {},39 else => {},
40 },40 },
41 .x86_64 => switch (@intToEnum(macho.reloc_type_x86_64, self.@"type")) {41 .x86_64 => switch (@intToEnum(macho.reloc_type_x86_64, self.type)) {
42 .X86_64_RELOC_GOT,42 .X86_64_RELOC_GOT,
43 .X86_64_RELOC_GOT_LOAD,43 .X86_64_RELOC_GOT_LOAD,
44 => return macho_file.getGotAtomForSymbol(self.target),44 => return macho_file.getGotAtomForSymbol(self.target),
...@@ -79,7 +79,7 @@ fn resolveAarch64(...@@ -79,7 +79,7 @@ fn resolveAarch64(
79 target_addr: i64,79 target_addr: i64,
80 base_offset: u64,80 base_offset: u64,
81) !void {81) !void {
82 const rel_type = @intToEnum(macho.reloc_type_arm64, self.@"type");82 const rel_type = @intToEnum(macho.reloc_type_arm64, self.type);
83 if (rel_type == .ARM64_RELOC_UNSIGNED) {83 if (rel_type == .ARM64_RELOC_UNSIGNED) {
84 var buffer: [@sizeOf(u64)]u8 = undefined;84 var buffer: [@sizeOf(u64)]u8 = undefined;
85 const code = blk: {85 const code = blk: {
...@@ -232,7 +232,7 @@ fn resolveX8664(...@@ -232,7 +232,7 @@ fn resolveX8664(
232 target_addr: i64,232 target_addr: i64,
233 base_offset: u64,233 base_offset: u64,
234) !void {234) !void {
235 const rel_type = @intToEnum(macho.reloc_type_x86_64, self.@"type");235 const rel_type = @intToEnum(macho.reloc_type_x86_64, self.type);
236 var buffer: [@sizeOf(u64)]u8 = undefined;236 var buffer: [@sizeOf(u64)]u8 = undefined;
237 const code = blk: {237 const code = blk: {
238 switch (rel_type) {238 switch (rel_type) {
src/link/MachO/ZldAtom.zig+2-2
...@@ -596,7 +596,7 @@ fn resolveRelocsArm64(...@@ -596,7 +596,7 @@ fn resolveRelocsArm64(
596 const is_tlv = is_tlv: {596 const is_tlv = is_tlv: {
597 const source_sym = zld.getSymbol(atom.getSymbolWithLoc());597 const source_sym = zld.getSymbol(atom.getSymbolWithLoc());
598 const header = zld.sections.items(.header)[source_sym.n_sect - 1];598 const header = zld.sections.items(.header)[source_sym.n_sect - 1];
599 break :is_tlv header.@"type"() == macho.S_THREAD_LOCAL_VARIABLES;599 break :is_tlv header.type() == macho.S_THREAD_LOCAL_VARIABLES;
600 };600 };
601 const target_addr = try getRelocTargetAddress(zld, rel, target, is_tlv);601 const target_addr = try getRelocTargetAddress(zld, rel, target, is_tlv);
602602
...@@ -877,7 +877,7 @@ fn resolveRelocsX86(...@@ -877,7 +877,7 @@ fn resolveRelocsX86(
877 const is_tlv = is_tlv: {877 const is_tlv = is_tlv: {
878 const source_sym = zld.getSymbol(atom.getSymbolWithLoc());878 const source_sym = zld.getSymbol(atom.getSymbolWithLoc());
879 const header = zld.sections.items(.header)[source_sym.n_sect - 1];879 const header = zld.sections.items(.header)[source_sym.n_sect - 1];
880 break :is_tlv header.@"type"() == macho.S_THREAD_LOCAL_VARIABLES;880 break :is_tlv header.type() == macho.S_THREAD_LOCAL_VARIABLES;
881 };881 };
882882
883 log.debug(" | source_addr = 0x{x}", .{source_addr});883 log.debug(" | source_addr = 0x{x}", .{source_addr});
src/link/MachO/dead_strip.zig+1-1
...@@ -107,7 +107,7 @@ fn collectRoots(zld: *Zld, roots: *AtomTable) !void {...@@ -107,7 +107,7 @@ fn collectRoots(zld: *Zld, roots: *AtomTable) !void {
107 };107 };
108 const source_sect = object.getSourceSection(sect_id);108 const source_sect = object.getSourceSection(sect_id);
109 if (source_sect.isDontDeadStrip()) break :blk true;109 if (source_sect.isDontDeadStrip()) break :blk true;
110 switch (source_sect.@"type"()) {110 switch (source_sect.type()) {
111 macho.S_MOD_INIT_FUNC_POINTERS,111 macho.S_MOD_INIT_FUNC_POINTERS,
112 macho.S_MOD_TERM_FUNC_POINTERS,112 macho.S_MOD_TERM_FUNC_POINTERS,
113 => break :blk true,113 => break :blk true,
src/link/MachO/zld.zig+9-9
...@@ -396,7 +396,7 @@ pub const Zld = struct {...@@ -396,7 +396,7 @@ pub const Zld = struct {
396 break :blk null;396 break :blk null;
397 }397 }
398398
399 switch (sect.@"type"()) {399 switch (sect.type()) {
400 macho.S_4BYTE_LITERALS,400 macho.S_4BYTE_LITERALS,
401 macho.S_8BYTE_LITERALS,401 macho.S_8BYTE_LITERALS,
402 macho.S_16BYTE_LITERALS,402 macho.S_16BYTE_LITERALS,
...@@ -1701,7 +1701,7 @@ pub const Zld = struct {...@@ -1701,7 +1701,7 @@ pub const Zld = struct {
1701 break :outer;1701 break :outer;
1702 }1702 }
1703 }1703 }
1704 switch (header.@"type"()) {1704 switch (header.type()) {
1705 macho.S_NON_LAZY_SYMBOL_POINTERS => {1705 macho.S_NON_LAZY_SYMBOL_POINTERS => {
1706 try self.writeGotPointer(count, buffer.writer());1706 try self.writeGotPointer(count, buffer.writer());
1707 },1707 },
...@@ -1718,7 +1718,7 @@ pub const Zld = struct {...@@ -1718,7 +1718,7 @@ pub const Zld = struct {
1718 break :outer;1718 break :outer;
1719 }1719 }
1720 }1720 }
1721 if (header.@"type"() == macho.S_SYMBOL_STUBS) {1721 if (header.type() == macho.S_SYMBOL_STUBS) {
1722 try self.writeStubCode(atom_index, count, buffer.writer());1722 try self.writeStubCode(atom_index, count, buffer.writer());
1723 } else if (mem.eql(u8, header.sectName(), "__stub_helper")) {1723 } else if (mem.eql(u8, header.sectName(), "__stub_helper")) {
1724 try self.writeStubHelperCode(atom_index, buffer.writer());1724 try self.writeStubHelperCode(atom_index, buffer.writer());
...@@ -1802,7 +1802,7 @@ pub const Zld = struct {...@@ -1802,7 +1802,7 @@ pub const Zld = struct {
1802 for (slice.items(.header)) |*header, sect_id| {1802 for (slice.items(.header)) |*header, sect_id| {
1803 if (header.size == 0) continue;1803 if (header.size == 0) continue;
1804 if (self.requiresThunks()) {1804 if (self.requiresThunks()) {
1805 if (header.isCode() and !(header.@"type"() == macho.S_SYMBOL_STUBS) and !mem.eql(u8, header.sectName(), "__stub_helper")) continue;1805 if (header.isCode() and !(header.type() == macho.S_SYMBOL_STUBS) and !mem.eql(u8, header.sectName(), "__stub_helper")) continue;
1806 }1806 }
18071807
1808 var atom_index = slice.items(.first_atom_index)[sect_id];1808 var atom_index = slice.items(.first_atom_index)[sect_id];
...@@ -1830,7 +1830,7 @@ pub const Zld = struct {...@@ -1830,7 +1830,7 @@ pub const Zld = struct {
1830 if (self.requiresThunks()) {1830 if (self.requiresThunks()) {
1831 for (slice.items(.header)) |header, sect_id| {1831 for (slice.items(.header)) |header, sect_id| {
1832 if (!header.isCode()) continue;1832 if (!header.isCode()) continue;
1833 if (header.@"type"() == macho.S_SYMBOL_STUBS) continue;1833 if (header.type() == macho.S_SYMBOL_STUBS) continue;
1834 if (mem.eql(u8, header.sectName(), "__stub_helper")) continue;1834 if (mem.eql(u8, header.sectName(), "__stub_helper")) continue;
18351835
1836 // Create jump/branch range extenders if needed.1836 // Create jump/branch range extenders if needed.
...@@ -1994,10 +1994,10 @@ pub const Zld = struct {...@@ -1994,10 +1994,10 @@ pub const Zld = struct {
1994 const section_precedence: u4 = blk: {1994 const section_precedence: u4 = blk: {
1995 if (header.isCode()) {1995 if (header.isCode()) {
1996 if (mem.eql(u8, "__text", header.sectName())) break :blk 0x0;1996 if (mem.eql(u8, "__text", header.sectName())) break :blk 0x0;
1997 if (header.@"type"() == macho.S_SYMBOL_STUBS) break :blk 0x1;1997 if (header.type() == macho.S_SYMBOL_STUBS) break :blk 0x1;
1998 break :blk 0x2;1998 break :blk 0x2;
1999 }1999 }
2000 switch (header.@"type"()) {2000 switch (header.type()) {
2001 macho.S_NON_LAZY_SYMBOL_POINTERS,2001 macho.S_NON_LAZY_SYMBOL_POINTERS,
2002 macho.S_LAZY_SYMBOL_POINTERS,2002 macho.S_LAZY_SYMBOL_POINTERS,
2003 => break :blk 0x0,2003 => break :blk 0x0,
...@@ -2121,7 +2121,7 @@ pub const Zld = struct {...@@ -2121,7 +2121,7 @@ pub const Zld = struct {
21212121
2122 // Finally, unpack the rest.2122 // Finally, unpack the rest.
2123 for (slice.items(.header)) |header, sect_id| {2123 for (slice.items(.header)) |header, sect_id| {
2124 switch (header.@"type"()) {2124 switch (header.type()) {
2125 macho.S_LITERAL_POINTERS,2125 macho.S_LITERAL_POINTERS,
2126 macho.S_REGULAR,2126 macho.S_REGULAR,
2127 macho.S_MOD_INIT_FUNC_POINTERS,2127 macho.S_MOD_INIT_FUNC_POINTERS,
...@@ -2252,7 +2252,7 @@ pub const Zld = struct {...@@ -2252,7 +2252,7 @@ pub const Zld = struct {
2252 // Finally, unpack the rest.2252 // Finally, unpack the rest.
2253 const slice = self.sections.slice();2253 const slice = self.sections.slice();
2254 for (slice.items(.header)) |header, sect_id| {2254 for (slice.items(.header)) |header, sect_id| {
2255 switch (header.@"type"()) {2255 switch (header.type()) {
2256 macho.S_LITERAL_POINTERS,2256 macho.S_LITERAL_POINTERS,
2257 macho.S_REGULAR,2257 macho.S_REGULAR,
2258 macho.S_MOD_INIT_FUNC_POINTERS,2258 macho.S_MOD_INIT_FUNC_POINTERS,
src/test.zig+4-4
...@@ -213,7 +213,7 @@ const TestManifestConfigDefaults = struct {...@@ -213,7 +213,7 @@ const TestManifestConfigDefaults = struct {
213///213///
214/// build test214/// build test
215const TestManifest = struct {215const TestManifest = struct {
216 @"type": Type,216 type: Type,
217 config_map: std.StringHashMap([]const u8),217 config_map: std.StringHashMap([]const u8),
218 trailing_bytes: []const u8 = "",218 trailing_bytes: []const u8 = "",
219219
...@@ -294,7 +294,7 @@ const TestManifest = struct {...@@ -294,7 +294,7 @@ const TestManifest = struct {
294 };294 };
295295
296 var manifest: TestManifest = .{296 var manifest: TestManifest = .{
297 .@"type" = tt,297 .type = tt,
298 .config_map = std.StringHashMap([]const u8).init(arena),298 .config_map = std.StringHashMap([]const u8).init(arena),
299 };299 };
300300
...@@ -320,7 +320,7 @@ const TestManifest = struct {...@@ -320,7 +320,7 @@ const TestManifest = struct {
320 key: []const u8,320 key: []const u8,
321 comptime T: type,321 comptime T: type,
322 ) ConfigValueIterator(T) {322 ) ConfigValueIterator(T) {
323 const bytes = self.config_map.get(key) orelse TestManifestConfigDefaults.get(self.@"type", key);323 const bytes = self.config_map.get(key) orelse TestManifestConfigDefaults.get(self.type, key);
324 return ConfigValueIterator(T){324 return ConfigValueIterator(T){
325 .inner = std.mem.split(u8, bytes, ","),325 .inner = std.mem.split(u8, bytes, ","),
326 };326 };
...@@ -1157,7 +1157,7 @@ pub const TestContext = struct {...@@ -1157,7 +1157,7 @@ pub const TestContext = struct {
11571157
1158 for (cases.items) |case_index| {1158 for (cases.items) |case_index| {
1159 const case = &ctx.cases.items[case_index];1159 const case = &ctx.cases.items[case_index];
1160 switch (manifest.@"type") {1160 switch (manifest.type) {
1161 .@"error" => {1161 .@"error" => {
1162 const errors = try manifest.trailingAlloc(ctx.arena);1162 const errors = try manifest.trailingAlloc(ctx.arena);
1163 switch (strategy) {1163 switch (strategy) {
src/type.zig+39-39
...@@ -80,8 +80,8 @@ pub const Type = extern union {...@@ -80,8 +80,8 @@ pub const Type = extern union {
80 .comptime_int => return .ComptimeInt,80 .comptime_int => return .ComptimeInt,
81 .comptime_float => return .ComptimeFloat,81 .comptime_float => return .ComptimeFloat,
82 .noreturn => return .NoReturn,82 .noreturn => return .NoReturn,
83 .@"null" => return .Null,83 .null => return .Null,
84 .@"undefined" => return .Undefined,84 .undefined => return .Undefined,
8585
86 .fn_noreturn_no_args => return .Fn,86 .fn_noreturn_no_args => return .Fn,
87 .fn_void_no_args => return .Fn,87 .fn_void_no_args => return .Fn,
...@@ -556,9 +556,9 @@ pub const Type = extern union {...@@ -556,9 +556,9 @@ pub const Type = extern union {
556 .comptime_int,556 .comptime_int,
557 .comptime_float,557 .comptime_float,
558 .noreturn,558 .noreturn,
559 .@"null",559 .null,
560 .@"undefined",560 .undefined,
561 .@"anyopaque",561 .anyopaque,
562 .@"anyframe",562 .@"anyframe",
563 .enum_literal,563 .enum_literal,
564 => |a_tag| {564 => |a_tag| {
...@@ -962,12 +962,12 @@ pub const Type = extern union {...@@ -962,12 +962,12 @@ pub const Type = extern union {
962 .comptime_int => std.hash.autoHash(hasher, std.builtin.TypeId.ComptimeInt),962 .comptime_int => std.hash.autoHash(hasher, std.builtin.TypeId.ComptimeInt),
963 .comptime_float => std.hash.autoHash(hasher, std.builtin.TypeId.ComptimeFloat),963 .comptime_float => std.hash.autoHash(hasher, std.builtin.TypeId.ComptimeFloat),
964 .noreturn => std.hash.autoHash(hasher, std.builtin.TypeId.NoReturn),964 .noreturn => std.hash.autoHash(hasher, std.builtin.TypeId.NoReturn),
965 .@"null" => std.hash.autoHash(hasher, std.builtin.TypeId.Null),965 .null => std.hash.autoHash(hasher, std.builtin.TypeId.Null),
966 .@"undefined" => std.hash.autoHash(hasher, std.builtin.TypeId.Undefined),966 .undefined => std.hash.autoHash(hasher, std.builtin.TypeId.Undefined),
967967
968 .@"anyopaque" => {968 .anyopaque => {
969 std.hash.autoHash(hasher, std.builtin.TypeId.Opaque);969 std.hash.autoHash(hasher, std.builtin.TypeId.Opaque);
970 std.hash.autoHash(hasher, Tag.@"anyopaque");970 std.hash.autoHash(hasher, Tag.anyopaque);
971 },971 },
972972
973 .@"anyframe" => {973 .@"anyframe" => {
...@@ -1299,8 +1299,8 @@ pub const Type = extern union {...@@ -1299,8 +1299,8 @@ pub const Type = extern union {
1299 .comptime_int,1299 .comptime_int,
1300 .comptime_float,1300 .comptime_float,
1301 .noreturn,1301 .noreturn,
1302 .@"null",1302 .null,
1303 .@"undefined",1303 .undefined,
1304 .fn_noreturn_no_args,1304 .fn_noreturn_no_args,
1305 .fn_void_no_args,1305 .fn_void_no_args,
1306 .fn_naked_noreturn_no_args,1306 .fn_naked_noreturn_no_args,
...@@ -1596,8 +1596,8 @@ pub const Type = extern union {...@@ -1596,8 +1596,8 @@ pub const Type = extern union {
1596 => return writer.writeAll(@tagName(t)),1596 => return writer.writeAll(@tagName(t)),
15971597
1598 .enum_literal => return writer.writeAll("@Type(.EnumLiteral)"),1598 .enum_literal => return writer.writeAll("@Type(.EnumLiteral)"),
1599 .@"null" => return writer.writeAll("@Type(.Null)"),1599 .null => return writer.writeAll("@Type(.Null)"),
1600 .@"undefined" => return writer.writeAll("@Type(.Undefined)"),1600 .undefined => return writer.writeAll("@Type(.Undefined)"),
16011601
1602 .empty_struct, .empty_struct_literal => return writer.writeAll("struct {}"),1602 .empty_struct, .empty_struct_literal => return writer.writeAll("struct {}"),
16031603
...@@ -1979,8 +1979,8 @@ pub const Type = extern union {...@@ -1979,8 +1979,8 @@ pub const Type = extern union {
1979 => try writer.writeAll(@tagName(t)),1979 => try writer.writeAll(@tagName(t)),
19801980
1981 .enum_literal => try writer.writeAll("@TypeOf(.enum_literal)"),1981 .enum_literal => try writer.writeAll("@TypeOf(.enum_literal)"),
1982 .@"null" => try writer.writeAll("@TypeOf(null)"),1982 .null => try writer.writeAll("@TypeOf(null)"),
1983 .@"undefined" => try writer.writeAll("@TypeOf(undefined)"),1983 .undefined => try writer.writeAll("@TypeOf(undefined)"),
1984 .empty_struct_literal => try writer.writeAll("@TypeOf(.{})"),1984 .empty_struct_literal => try writer.writeAll("@TypeOf(.{})"),
19851985
1986 .empty_struct => {1986 .empty_struct => {
...@@ -2282,8 +2282,8 @@ pub const Type = extern union {...@@ -2282,8 +2282,8 @@ pub const Type = extern union {
2282 .comptime_int => return Value.initTag(.comptime_int_type),2282 .comptime_int => return Value.initTag(.comptime_int_type),
2283 .comptime_float => return Value.initTag(.comptime_float_type),2283 .comptime_float => return Value.initTag(.comptime_float_type),
2284 .noreturn => return Value.initTag(.noreturn_type),2284 .noreturn => return Value.initTag(.noreturn_type),
2285 .@"null" => return Value.initTag(.null_type),2285 .null => return Value.initTag(.null_type),
2286 .@"undefined" => return Value.initTag(.undefined_type),2286 .undefined => return Value.initTag(.undefined_type),
2287 .fn_noreturn_no_args => return Value.initTag(.fn_noreturn_no_args_type),2287 .fn_noreturn_no_args => return Value.initTag(.fn_noreturn_no_args_type),
2288 .fn_void_no_args => return Value.initTag(.fn_void_no_args_type),2288 .fn_void_no_args => return Value.initTag(.fn_void_no_args_type),
2289 .fn_naked_noreturn_no_args => return Value.initTag(.fn_naked_noreturn_no_args_type),2289 .fn_naked_noreturn_no_args => return Value.initTag(.fn_naked_noreturn_no_args_type),
...@@ -2420,8 +2420,8 @@ pub const Type = extern union {...@@ -2420,8 +2420,8 @@ pub const Type = extern union {
2420 .comptime_int,2420 .comptime_int,
2421 .comptime_float,2421 .comptime_float,
2422 .noreturn,2422 .noreturn,
2423 .@"null",2423 .null,
2424 .@"undefined",2424 .undefined,
2425 .enum_literal,2425 .enum_literal,
2426 .empty_struct,2426 .empty_struct,
2427 .empty_struct_literal,2427 .empty_struct_literal,
...@@ -2600,9 +2600,9 @@ pub const Type = extern union {...@@ -2600,9 +2600,9 @@ pub const Type = extern union {
2600 .anyopaque,2600 .anyopaque,
2601 .anyerror,2601 .anyerror,
2602 .noreturn,2602 .noreturn,
2603 .@"null",2603 .null,
2604 .@"anyframe",2604 .@"anyframe",
2605 .@"undefined",2605 .undefined,
2606 .atomic_order,2606 .atomic_order,
2607 .atomic_rmw_op,2607 .atomic_rmw_op,
2608 .calling_convention,2608 .calling_convention,
...@@ -3109,8 +3109,8 @@ pub const Type = extern union {...@@ -3109,8 +3109,8 @@ pub const Type = extern union {
3109 .type,3109 .type,
3110 .comptime_int,3110 .comptime_int,
3111 .comptime_float,3111 .comptime_float,
3112 .@"null",3112 .null,
3113 .@"undefined",3113 .undefined,
3114 .enum_literal,3114 .enum_literal,
3115 .type_info,3115 .type_info,
3116 => return AbiAlignmentAdvanced{ .scalar = 0 },3116 => return AbiAlignmentAdvanced{ .scalar = 0 },
...@@ -3231,8 +3231,8 @@ pub const Type = extern union {...@@ -3231,8 +3231,8 @@ pub const Type = extern union {
3231 .type,3231 .type,
3232 .comptime_int,3232 .comptime_int,
3233 .comptime_float,3233 .comptime_float,
3234 .@"null",3234 .null,
3235 .@"undefined",3235 .undefined,
3236 .enum_literal,3236 .enum_literal,
3237 .single_const_pointer_to_comptime_int,3237 .single_const_pointer_to_comptime_int,
3238 .empty_struct_literal,3238 .empty_struct_literal,
...@@ -3554,8 +3554,8 @@ pub const Type = extern union {...@@ -3554,8 +3554,8 @@ pub const Type = extern union {
3554 .comptime_int => unreachable,3554 .comptime_int => unreachable,
3555 .comptime_float => unreachable,3555 .comptime_float => unreachable,
3556 .noreturn => unreachable,3556 .noreturn => unreachable,
3557 .@"null" => unreachable,3557 .null => unreachable,
3558 .@"undefined" => unreachable,3558 .undefined => unreachable,
3559 .enum_literal => unreachable,3559 .enum_literal => unreachable,
3560 .single_const_pointer_to_comptime_int => unreachable,3560 .single_const_pointer_to_comptime_int => unreachable,
3561 .empty_struct => unreachable,3561 .empty_struct => unreachable,
...@@ -4157,7 +4157,7 @@ pub const Type = extern union {...@@ -4157,7 +4157,7 @@ pub const Type = extern union {
4157 .optional_single_const_pointer => ty.castPointer().?.data,4157 .optional_single_const_pointer => ty.castPointer().?.data,
41584158
4159 .anyframe_T => ty.castTag(.anyframe_T).?.data,4159 .anyframe_T => ty.castTag(.anyframe_T).?.data,
4160 .@"anyframe" => Type.@"void",4160 .@"anyframe" => Type.void,
41614161
4162 else => unreachable,4162 else => unreachable,
4163 };4163 };
...@@ -4975,7 +4975,7 @@ pub const Type = extern union {...@@ -4975,7 +4975,7 @@ pub const Type = extern union {
4975 var buf: Payload.ElemType = undefined;4975 var buf: Payload.ElemType = undefined;
4976 const child_ty = ty.optionalChild(&buf);4976 const child_ty = ty.optionalChild(&buf);
4977 if (child_ty.isNoReturn()) {4977 if (child_ty.isNoReturn()) {
4978 return Value.@"null";4978 return Value.null;
4979 } else {4979 } else {
4980 return null;4980 return null;
4981 }4981 }
...@@ -5057,8 +5057,8 @@ pub const Type = extern union {...@@ -5057,8 +5057,8 @@ pub const Type = extern union {
5057 .empty_struct, .empty_struct_literal => return Value.initTag(.empty_struct_value),5057 .empty_struct, .empty_struct_literal => return Value.initTag(.empty_struct_value),
5058 .void => return Value.initTag(.void_value),5058 .void => return Value.initTag(.void_value),
5059 .noreturn => return Value.initTag(.unreachable_value),5059 .noreturn => return Value.initTag(.unreachable_value),
5060 .@"null" => return Value.initTag(.null_value),5060 .null => return Value.initTag(.null_value),
5061 .@"undefined" => return Value.initTag(.undef),5061 .undefined => return Value.initTag(.undef),
50625062
5063 .int_unsigned, .int_signed => {5063 .int_unsigned, .int_signed => {
5064 if (ty.cast(Payload.Bits).?.data == 0) {5064 if (ty.cast(Payload.Bits).?.data == 0) {
...@@ -5121,8 +5121,8 @@ pub const Type = extern union {...@@ -5121,8 +5121,8 @@ pub const Type = extern union {
5121 .anyerror,5121 .anyerror,
5122 .noreturn,5122 .noreturn,
5123 .@"anyframe",5123 .@"anyframe",
5124 .@"null",5124 .null,
5125 .@"undefined",5125 .undefined,
5126 .atomic_order,5126 .atomic_order,
5127 .atomic_rmw_op,5127 .atomic_rmw_op,
5128 .calling_convention,5128 .calling_convention,
...@@ -5937,8 +5937,8 @@ pub const Type = extern union {...@@ -5937,8 +5937,8 @@ pub const Type = extern union {
5937 comptime_float,5937 comptime_float,
5938 noreturn,5938 noreturn,
5939 @"anyframe",5939 @"anyframe",
5940 @"null",5940 null,
5941 @"undefined",5941 undefined,
5942 enum_literal,5942 enum_literal,
5943 atomic_order,5943 atomic_order,
5944 atomic_rmw_op,5944 atomic_rmw_op,
...@@ -6062,8 +6062,8 @@ pub const Type = extern union {...@@ -6062,8 +6062,8 @@ pub const Type = extern union {
6062 .comptime_float,6062 .comptime_float,
6063 .noreturn,6063 .noreturn,
6064 .enum_literal,6064 .enum_literal,
6065 .@"null",6065 .null,
6066 .@"undefined",6066 .undefined,
6067 .fn_noreturn_no_args,6067 .fn_noreturn_no_args,
6068 .fn_void_no_args,6068 .fn_void_no_args,
6069 .fn_naked_noreturn_no_args,6069 .fn_naked_noreturn_no_args,
...@@ -6420,7 +6420,7 @@ pub const Type = extern union {...@@ -6420,7 +6420,7 @@ pub const Type = extern union {
6420 pub const @"type" = initTag(.type);6420 pub const @"type" = initTag(.type);
6421 pub const @"anyerror" = initTag(.anyerror);6421 pub const @"anyerror" = initTag(.anyerror);
6422 pub const @"anyopaque" = initTag(.anyopaque);6422 pub const @"anyopaque" = initTag(.anyopaque);
6423 pub const @"null" = initTag(.@"null");6423 pub const @"null" = initTag(.null);
64246424
6425 pub const err_int = Type.u16;6425 pub const err_int = Type.u16;
64266426
...@@ -6559,7 +6559,7 @@ pub const Type = extern union {...@@ -6559,7 +6559,7 @@ pub const Type = extern union {
6559 mod: *Module,6559 mod: *Module,
6560 ) Allocator.Error!Type {6560 ) Allocator.Error!Type {
6561 assert(error_set.zigTypeTag() == .ErrorSet);6561 assert(error_set.zigTypeTag() == .ErrorSet);
6562 if (error_set.eql(Type.@"anyerror", mod) and6562 if (error_set.eql(Type.anyerror, mod) and
6563 payload.eql(Type.void, mod))6563 payload.eql(Type.void, mod))
6564 {6564 {
6565 return Type.initTag(.anyerror_void_error_union);6565 return Type.initTag(.anyerror_void_error_union);
src/value.zig+9-9
...@@ -941,8 +941,8 @@ pub const Value = extern union {...@@ -941,8 +941,8 @@ pub const Value = extern union {
941 .comptime_int_type => Type.initTag(.comptime_int),941 .comptime_int_type => Type.initTag(.comptime_int),
942 .comptime_float_type => Type.initTag(.comptime_float),942 .comptime_float_type => Type.initTag(.comptime_float),
943 .noreturn_type => Type.initTag(.noreturn),943 .noreturn_type => Type.initTag(.noreturn),
944 .null_type => Type.initTag(.@"null"),944 .null_type => Type.initTag(.null),
945 .undefined_type => Type.initTag(.@"undefined"),945 .undefined_type => Type.initTag(.undefined),
946 .fn_noreturn_no_args_type => Type.initTag(.fn_noreturn_no_args),946 .fn_noreturn_no_args_type => Type.initTag(.fn_noreturn_no_args),
947 .fn_void_no_args_type => Type.initTag(.fn_void_no_args),947 .fn_void_no_args_type => Type.initTag(.fn_void_no_args),
948 .fn_naked_noreturn_no_args_type => Type.initTag(.fn_naked_noreturn_no_args),948 .fn_naked_noreturn_no_args_type => Type.initTag(.fn_naked_noreturn_no_args),
...@@ -1437,12 +1437,12 @@ pub const Value = extern union {...@@ -1437,12 +1437,12 @@ pub const Value = extern union {
1437 const target = mod.getTarget();1437 const target = mod.getTarget();
1438 const endian = target.cpu.arch.endian();1438 const endian = target.cpu.arch.endian();
1439 switch (ty.zigTypeTag()) {1439 switch (ty.zigTypeTag()) {
1440 .Void => return Value.@"void",1440 .Void => return Value.void,
1441 .Bool => {1441 .Bool => {
1442 if (buffer[0] == 0) {1442 if (buffer[0] == 0) {
1443 return Value.@"false";1443 return Value.false;
1444 } else {1444 } else {
1445 return Value.@"true";1445 return Value.true;
1446 }1446 }
1447 },1447 },
1448 .Int, .Enum => {1448 .Int, .Enum => {
...@@ -1542,16 +1542,16 @@ pub const Value = extern union {...@@ -1542,16 +1542,16 @@ pub const Value = extern union {
1542 const target = mod.getTarget();1542 const target = mod.getTarget();
1543 const endian = target.cpu.arch.endian();1543 const endian = target.cpu.arch.endian();
1544 switch (ty.zigTypeTag()) {1544 switch (ty.zigTypeTag()) {
1545 .Void => return Value.@"void",1545 .Void => return Value.void,
1546 .Bool => {1546 .Bool => {
1547 const byte = switch (endian) {1547 const byte = switch (endian) {
1548 .Big => buffer[buffer.len - bit_offset / 8 - 1],1548 .Big => buffer[buffer.len - bit_offset / 8 - 1],
1549 .Little => buffer[bit_offset / 8],1549 .Little => buffer[bit_offset / 8],
1550 };1550 };
1551 if (((byte >> @intCast(u3, bit_offset % 8)) & 1) == 0) {1551 if (((byte >> @intCast(u3, bit_offset % 8)) & 1) == 0) {
1552 return Value.@"false";1552 return Value.false;
1553 } else {1553 } else {
1554 return Value.@"true";1554 return Value.true;
1555 }1555 }
1556 },1556 },
1557 .Int, .Enum => {1557 .Int, .Enum => {
...@@ -5279,7 +5279,7 @@ pub const Value = extern union {...@@ -5279,7 +5279,7 @@ pub const Value = extern union {
5279 pub const @"true" = initTag(.bool_true);5279 pub const @"true" = initTag(.bool_true);
52805280
5281 pub fn makeBool(x: bool) Value {5281 pub fn makeBool(x: bool) Value {
5282 return if (x) Value.@"true" else Value.@"false";5282 return if (x) Value.true else Value.false;
5283 }5283 }
52845284
5285 pub const RuntimeIndex = enum(u32) {5285 pub const RuntimeIndex = enum(u32) {
test/behavior/bitcast.zig+1-1
...@@ -337,7 +337,7 @@ test "comptime @bitCast packed struct to int and back" {...@@ -337,7 +337,7 @@ test "comptime @bitCast packed struct to int and back" {
337 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;337 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
338338
339 const S = packed struct {339 const S = packed struct {
340 @"void": void = {},340 void: void = {},
341 uint: u8 = 13,341 uint: u8 = 13,
342 uint_bit_aligned: u3 = 2,342 uint_bit_aligned: u3 = 2,
343 iint_pos: i4 = 1,343 iint_pos: i4 = 1,
tools/gen_spirv_spec.zig-1
...@@ -193,7 +193,6 @@ fn renderOpcodes(...@@ -193,7 +193,6 @@ fn renderOpcodes(
193 try renderOperand(writer, .instruction, inst.opname, inst.operands, extended_structs);193 try renderOperand(writer, .instruction, inst.opname, inst.operands, extended_structs);
194 }194 }
195 try writer.writeAll("};\n}\n};\n");195 try writer.writeAll("};\n}\n};\n");
196 _ = extended_structs;
197}196}
198197
199fn renderOperandKinds(198fn renderOperandKinds(