| author | |
| committer | |
| log | e409afb79bcadeabd2d5d4cc3cd5dcc54a964e94 |
| tree | d09f9cc93ce8c44e5769e9124a0bd488a257345e |
| parent | 9b2345e182090e2f4c57e7684ec9739f195fdb1d |
30 files changed, 87 insertions(+), 87 deletions(-)
lib/compiler/aro/aro/pragmas/gcc.zig+6-6| ... | @@ -37,18 +37,18 @@ const Directive = enum { | ... | @@ -37,18 +37,18 @@ const Directive = enum { |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | fn beforePreprocess(pragma: *Pragma, comp: *Compilation) void { | 39 | fn beforePreprocess(pragma: *Pragma, comp: *Compilation) void { |
| 40 | var self = @fieldParentPtr(GCC, "pragma", pragma); | 40 | var self = @fieldParentPtr(*GCC, "pragma", pragma); |
| 41 | self.original_options = comp.diagnostics.options; | 41 | self.original_options = comp.diagnostics.options; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | fn beforeParse(pragma: *Pragma, comp: *Compilation) void { | 44 | fn beforeParse(pragma: *Pragma, comp: *Compilation) void { |
| 45 | var self = @fieldParentPtr(GCC, "pragma", pragma); | 45 | var self = @fieldParentPtr(*GCC, "pragma", pragma); |
| 46 | comp.diagnostics.options = self.original_options; | 46 | comp.diagnostics.options = self.original_options; |
| 47 | self.options_stack.items.len = 0; | 47 | self.options_stack.items.len = 0; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | fn afterParse(pragma: *Pragma, comp: *Compilation) void { | 50 | fn afterParse(pragma: *Pragma, comp: *Compilation) void { |
| 51 | var self = @fieldParentPtr(GCC, "pragma", pragma); | 51 | var self = @fieldParentPtr(*GCC, "pragma", pragma); |
| 52 | comp.diagnostics.options = self.original_options; | 52 | comp.diagnostics.options = self.original_options; |
| 53 | self.options_stack.items.len = 0; | 53 | self.options_stack.items.len = 0; |
| 54 | } | 54 | } |
| ... | @@ -60,7 +60,7 @@ pub fn init(allocator: mem.Allocator) !*Pragma { | ... | @@ -60,7 +60,7 @@ pub fn init(allocator: mem.Allocator) !*Pragma { |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | fn deinit(pragma: *Pragma, comp: *Compilation) void { | 62 | fn deinit(pragma: *Pragma, comp: *Compilation) void { |
| 63 | var self = @fieldParentPtr(GCC, "pragma", pragma); | 63 | var self = @fieldParentPtr(*GCC, "pragma", pragma); |
| 64 | self.options_stack.deinit(comp.gpa); | 64 | self.options_stack.deinit(comp.gpa); |
| 65 | comp.gpa.destroy(self); | 65 | comp.gpa.destroy(self); |
| 66 | } | 66 | } |
| ... | @@ -108,7 +108,7 @@ fn diagnosticHandler(self: *GCC, pp: *Preprocessor, start_idx: TokenIndex) Pragm | ... | @@ -108,7 +108,7 @@ fn diagnosticHandler(self: *GCC, pp: *Preprocessor, start_idx: TokenIndex) Pragm |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pragma.Error!void { | 110 | fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pragma.Error!void { |
| 111 | var self = @fieldParentPtr(GCC, "pragma", pragma); | 111 | var self = @fieldParentPtr(*GCC, "pragma", pragma); |
| 112 | const directive_tok = pp.tokens.get(start_idx + 1); | 112 | const directive_tok = pp.tokens.get(start_idx + 1); |
| 113 | if (directive_tok.id == .nl) return; | 113 | if (directive_tok.id == .nl) return; |
| 114 | 114 | ||
| ... | @@ -174,7 +174,7 @@ fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex | ... | @@ -174,7 +174,7 @@ fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | fn parserHandler(pragma: *Pragma, p: *Parser, start_idx: TokenIndex) Compilation.Error!void { | 176 | fn parserHandler(pragma: *Pragma, p: *Parser, start_idx: TokenIndex) Compilation.Error!void { |
| 177 | var self = @fieldParentPtr(GCC, "pragma", pragma); | 177 | var self = @fieldParentPtr(*GCC, "pragma", pragma); |
| 178 | const directive_tok = p.pp.tokens.get(start_idx + 1); | 178 | const directive_tok = p.pp.tokens.get(start_idx + 1); |
| 179 | if (directive_tok.id == .nl) return; | 179 | if (directive_tok.id == .nl) return; |
| 180 | const name = p.pp.expandedSlice(directive_tok); | 180 | const name = p.pp.expandedSlice(directive_tok); |
lib/compiler/aro/aro/pragmas/message.zig+1-1| ... | @@ -22,7 +22,7 @@ pub fn init(allocator: mem.Allocator) !*Pragma { | ... | @@ -22,7 +22,7 @@ pub fn init(allocator: mem.Allocator) !*Pragma { |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | fn deinit(pragma: *Pragma, comp: *Compilation) void { | 24 | fn deinit(pragma: *Pragma, comp: *Compilation) void { |
| 25 | const self = @fieldParentPtr(Message, "pragma", pragma); | 25 | const self = @fieldParentPtr(*Message, "pragma", pragma); |
| 26 | comp.gpa.destroy(self); | 26 | comp.gpa.destroy(self); |
| 27 | } | 27 | } |
| 28 | 28 |
lib/compiler/aro/aro/pragmas/once.zig+3-3| ... | @@ -27,18 +27,18 @@ pub fn init(allocator: mem.Allocator) !*Pragma { | ... | @@ -27,18 +27,18 @@ pub fn init(allocator: mem.Allocator) !*Pragma { |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | fn afterParse(pragma: *Pragma, _: *Compilation) void { | 29 | fn afterParse(pragma: *Pragma, _: *Compilation) void { |
| 30 | var self = @fieldParentPtr(Once, "pragma", pragma); | 30 | var self = @fieldParentPtr(*Once, "pragma", pragma); |
| 31 | self.pragma_once.clearRetainingCapacity(); | 31 | self.pragma_once.clearRetainingCapacity(); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | fn deinit(pragma: *Pragma, comp: *Compilation) void { | 34 | fn deinit(pragma: *Pragma, comp: *Compilation) void { |
| 35 | var self = @fieldParentPtr(Once, "pragma", pragma); | 35 | var self = @fieldParentPtr(*Once, "pragma", pragma); |
| 36 | self.pragma_once.deinit(); | 36 | self.pragma_once.deinit(); |
| 37 | comp.gpa.destroy(self); | 37 | comp.gpa.destroy(self); |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pragma.Error!void { | 40 | fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pragma.Error!void { |
| 41 | var self = @fieldParentPtr(Once, "pragma", pragma); | 41 | var self = @fieldParentPtr(*Once, "pragma", pragma); |
| 42 | const name_tok = pp.tokens.get(start_idx); | 42 | const name_tok = pp.tokens.get(start_idx); |
| 43 | const next = pp.tokens.get(start_idx + 1); | 43 | const next = pp.tokens.get(start_idx + 1); |
| 44 | if (next.id != .nl) { | 44 | if (next.id != .nl) { |
lib/compiler/aro/aro/pragmas/pack.zig+2-2| ... | @@ -24,13 +24,13 @@ pub fn init(allocator: mem.Allocator) !*Pragma { | ... | @@ -24,13 +24,13 @@ pub fn init(allocator: mem.Allocator) !*Pragma { |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | fn deinit(pragma: *Pragma, comp: *Compilation) void { | 26 | fn deinit(pragma: *Pragma, comp: *Compilation) void { |
| 27 | var self = @fieldParentPtr(Pack, "pragma", pragma); | 27 | var self = @fieldParentPtr(*Pack, "pragma", pragma); |
| 28 | self.stack.deinit(comp.gpa); | 28 | self.stack.deinit(comp.gpa); |
| 29 | comp.gpa.destroy(self); | 29 | comp.gpa.destroy(self); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | fn parserHandler(pragma: *Pragma, p: *Parser, start_idx: TokenIndex) Compilation.Error!void { | 32 | fn parserHandler(pragma: *Pragma, p: *Parser, start_idx: TokenIndex) Compilation.Error!void { |
| 33 | var pack = @fieldParentPtr(Pack, "pragma", pragma); | 33 | var pack = @fieldParentPtr(*Pack, "pragma", pragma); |
| 34 | var idx = start_idx + 1; | 34 | var idx = start_idx + 1; |
| 35 | const l_paren = p.pp.tokens.get(idx); | 35 | const l_paren = p.pp.tokens.get(idx); |
| 36 | if (l_paren.id != .l_paren) { | 36 | if (l_paren.id != .l_paren) { |
lib/compiler/aro_translate_c.zig+9-9| ... | @@ -1103,8 +1103,8 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ | ... | @@ -1103,8 +1103,8 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ |
| 1103 | while (true) { | 1103 | while (true) { |
| 1104 | switch (scope.id) { | 1104 | switch (scope.id) { |
| 1105 | .root => unreachable, | 1105 | .root => unreachable, |
| 1106 | .block => return @fieldParentPtr(Block, "base", scope), | 1106 | .block => return @fieldParentPtr(*Block, "base", scope), |
| 1107 | .condition => return @fieldParentPtr(Condition, "base", scope).getBlockScope(c), | 1107 | .condition => return @fieldParentPtr(*Condition, "base", scope).getBlockScope(c), |
| 1108 | else => scope = scope.parent.?, | 1108 | else => scope = scope.parent.?, |
| 1109 | } | 1109 | } |
| 1110 | } | 1110 | } |
| ... | @@ -1116,7 +1116,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ | ... | @@ -1116,7 +1116,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ |
| 1116 | switch (scope.id) { | 1116 | switch (scope.id) { |
| 1117 | .root => unreachable, | 1117 | .root => unreachable, |
| 1118 | .block => { | 1118 | .block => { |
| 1119 | const block = @fieldParentPtr(Block, "base", scope); | 1119 | const block = @fieldParentPtr(*Block, "base", scope); |
| 1120 | if (block.return_type) |ty| return ty; | 1120 | if (block.return_type) |ty| return ty; |
| 1121 | scope = scope.parent.?; | 1121 | scope = scope.parent.?; |
| 1122 | }, | 1122 | }, |
| ... | @@ -1128,15 +1128,15 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ | ... | @@ -1128,15 +1128,15 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ |
| 1128 | pub fn getAlias(scope: *ScopeExtraScope, name: []const u8) []const u8 { | 1128 | pub fn getAlias(scope: *ScopeExtraScope, name: []const u8) []const u8 { |
| 1129 | return switch (scope.id) { | 1129 | return switch (scope.id) { |
| 1130 | .root => return name, | 1130 | .root => return name, |
| 1131 | .block => @fieldParentPtr(Block, "base", scope).getAlias(name), | 1131 | .block => @fieldParentPtr(*Block, "base", scope).getAlias(name), |
| 1132 | .loop, .do_loop, .condition => scope.parent.?.getAlias(name), | 1132 | .loop, .do_loop, .condition => scope.parent.?.getAlias(name), |
| 1133 | }; | 1133 | }; |
| 1134 | } | 1134 | } |
| 1135 | 1135 | ||
| 1136 | pub fn contains(scope: *ScopeExtraScope, name: []const u8) bool { | 1136 | pub fn contains(scope: *ScopeExtraScope, name: []const u8) bool { |
| 1137 | return switch (scope.id) { | 1137 | return switch (scope.id) { |
| 1138 | .root => @fieldParentPtr(Root, "base", scope).contains(name), | 1138 | .root => @fieldParentPtr(*Root, "base", scope).contains(name), |
| 1139 | .block => @fieldParentPtr(Block, "base", scope).contains(name), | 1139 | .block => @fieldParentPtr(*Block, "base", scope).contains(name), |
| 1140 | .loop, .do_loop, .condition => scope.parent.?.contains(name), | 1140 | .loop, .do_loop, .condition => scope.parent.?.contains(name), |
| 1141 | }; | 1141 | }; |
| 1142 | } | 1142 | } |
| ... | @@ -1158,11 +1158,11 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ | ... | @@ -1158,11 +1158,11 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ |
| 1158 | while (true) { | 1158 | while (true) { |
| 1159 | switch (scope.id) { | 1159 | switch (scope.id) { |
| 1160 | .root => { | 1160 | .root => { |
| 1161 | const root = @fieldParentPtr(Root, "base", scope); | 1161 | const root = @fieldParentPtr(*Root, "base", scope); |
| 1162 | return root.nodes.append(node); | 1162 | return root.nodes.append(node); |
| 1163 | }, | 1163 | }, |
| 1164 | .block => { | 1164 | .block => { |
| 1165 | const block = @fieldParentPtr(Block, "base", scope); | 1165 | const block = @fieldParentPtr(*Block, "base", scope); |
| 1166 | return block.statements.append(node); | 1166 | return block.statements.append(node); |
| 1167 | }, | 1167 | }, |
| 1168 | else => scope = scope.parent.?, | 1168 | else => scope = scope.parent.?, |
| ... | @@ -1184,7 +1184,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ | ... | @@ -1184,7 +1184,7 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ |
| 1184 | switch (scope.id) { | 1184 | switch (scope.id) { |
| 1185 | .root => return, | 1185 | .root => return, |
| 1186 | .block => { | 1186 | .block => { |
| 1187 | const block = @fieldParentPtr(Block, "base", scope); | 1187 | const block = @fieldParentPtr(*Block, "base", scope); |
| 1188 | if (block.variable_discards.get(name)) |discard| { | 1188 | if (block.variable_discards.get(name)) |discard| { |
| 1189 | discard.data.should_skip = true; | 1189 | discard.data.should_skip = true; |
| 1190 | return; | 1190 | return; |
lib/compiler/aro_translate_c/ast.zig+8-8| ... | @@ -409,7 +409,7 @@ pub const Node = extern union { | ... | @@ -409,7 +409,7 @@ pub const Node = extern union { |
| 409 | return null; | 409 | return null; |
| 410 | 410 | ||
| 411 | if (self.ptr_otherwise.tag == t) | 411 | if (self.ptr_otherwise.tag == t) |
| 412 | return @fieldParentPtr(t.Type(), "base", self.ptr_otherwise); | 412 | return @alignCast(@fieldParentPtr(*align(1) t.Type(), "base", self.ptr_otherwise)); |
| 413 | 413 | ||
| 414 | return null; | 414 | return null; |
| 415 | } | 415 | } |
| ... | @@ -1220,7 +1220,7 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { | ... | @@ -1220,7 +1220,7 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { |
| 1220 | }); | 1220 | }); |
| 1221 | }, | 1221 | }, |
| 1222 | .pub_var_simple, .var_simple => { | 1222 | .pub_var_simple, .var_simple => { |
| 1223 | const payload = @fieldParentPtr(Payload.SimpleVarDecl, "base", node.ptr_otherwise).data; | 1223 | const payload = @as(*Payload.SimpleVarDecl, @alignCast(@fieldParentPtr(*align(1) Payload.SimpleVarDecl, "base", node.ptr_otherwise))).data; |
| 1224 | if (node.tag() == .pub_var_simple) _ = try c.addToken(.keyword_pub, "pub"); | 1224 | if (node.tag() == .pub_var_simple) _ = try c.addToken(.keyword_pub, "pub"); |
| 1225 | const const_tok = try c.addToken(.keyword_const, "const"); | 1225 | const const_tok = try c.addToken(.keyword_const, "const"); |
| 1226 | _ = try c.addIdentifier(payload.name); | 1226 | _ = try c.addIdentifier(payload.name); |
| ... | @@ -1293,7 +1293,7 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { | ... | @@ -1293,7 +1293,7 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { |
| 1293 | }, | 1293 | }, |
| 1294 | .var_decl => return renderVar(c, node), | 1294 | .var_decl => return renderVar(c, node), |
| 1295 | .arg_redecl, .alias => { | 1295 | .arg_redecl, .alias => { |
| 1296 | const payload = @fieldParentPtr(Payload.ArgRedecl, "base", node.ptr_otherwise).data; | 1296 | const payload = @as(*Payload.ArgRedecl, @alignCast(@fieldParentPtr(*align(1) Payload.ArgRedecl, "base", node.ptr_otherwise))).data; |
| 1297 | if (node.tag() == .alias) _ = try c.addToken(.keyword_pub, "pub"); | 1297 | if (node.tag() == .alias) _ = try c.addToken(.keyword_pub, "pub"); |
| 1298 | const mut_tok = if (node.tag() == .alias) | 1298 | const mut_tok = if (node.tag() == .alias) |
| 1299 | try c.addToken(.keyword_const, "const") | 1299 | try c.addToken(.keyword_const, "const") |
| ... | @@ -1492,7 +1492,7 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { | ... | @@ -1492,7 +1492,7 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { |
| 1492 | }); | 1492 | }); |
| 1493 | }, | 1493 | }, |
| 1494 | .c_pointer, .single_pointer => { | 1494 | .c_pointer, .single_pointer => { |
| 1495 | const payload = @fieldParentPtr(Payload.Pointer, "base", node.ptr_otherwise).data; | 1495 | const payload = @as(*Payload.Pointer, @alignCast(@fieldParentPtr(*align(1) Payload.Pointer, "base", node.ptr_otherwise))).data; |
| 1496 | 1496 | ||
| 1497 | const asterisk = if (node.tag() == .single_pointer) | 1497 | const asterisk = if (node.tag() == .single_pointer) |
| 1498 | try c.addToken(.asterisk, "*") | 1498 | try c.addToken(.asterisk, "*") |
| ... | @@ -2085,7 +2085,7 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { | ... | @@ -2085,7 +2085,7 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { |
| 2085 | } | 2085 | } |
| 2086 | 2086 | ||
| 2087 | fn renderRecord(c: *Context, node: Node) !NodeIndex { | 2087 | fn renderRecord(c: *Context, node: Node) !NodeIndex { |
| 2088 | const payload = @fieldParentPtr(Payload.Record, "base", node.ptr_otherwise).data; | 2088 | const payload = @as(*Payload.Record, @alignCast(@fieldParentPtr(*align(1) Payload.Record, "base", node.ptr_otherwise))).data; |
| 2089 | if (payload.layout == .@"packed") | 2089 | if (payload.layout == .@"packed") |
| 2090 | _ = try c.addToken(.keyword_packed, "packed") | 2090 | _ = try c.addToken(.keyword_packed, "packed") |
| 2091 | else if (payload.layout == .@"extern") | 2091 | else if (payload.layout == .@"extern") |
| ... | @@ -2487,7 +2487,7 @@ fn renderNodeGrouped(c: *Context, node: Node) !NodeIndex { | ... | @@ -2487,7 +2487,7 @@ fn renderNodeGrouped(c: *Context, node: Node) !NodeIndex { |
| 2487 | } | 2487 | } |
| 2488 | 2488 | ||
| 2489 | fn renderPrefixOp(c: *Context, node: Node, tag: std.zig.Ast.Node.Tag, tok_tag: TokenTag, bytes: []const u8) !NodeIndex { | 2489 | fn renderPrefixOp(c: *Context, node: Node, tag: std.zig.Ast.Node.Tag, tok_tag: TokenTag, bytes: []const u8) !NodeIndex { |
| 2490 | const payload = @fieldParentPtr(Payload.UnOp, "base", node.ptr_otherwise).data; | 2490 | const payload = @as(*Payload.UnOp, @alignCast(@fieldParentPtr(*align(1) Payload.UnOp, "base", node.ptr_otherwise))).data; |
| 2491 | return c.addNode(.{ | 2491 | return c.addNode(.{ |
| 2492 | .tag = tag, | 2492 | .tag = tag, |
| 2493 | .main_token = try c.addToken(tok_tag, bytes), | 2493 | .main_token = try c.addToken(tok_tag, bytes), |
| ... | @@ -2499,7 +2499,7 @@ fn renderPrefixOp(c: *Context, node: Node, tag: std.zig.Ast.Node.Tag, tok_tag: T | ... | @@ -2499,7 +2499,7 @@ fn renderPrefixOp(c: *Context, node: Node, tag: std.zig.Ast.Node.Tag, tok_tag: T |
| 2499 | } | 2499 | } |
| 2500 | 2500 | ||
| 2501 | fn renderBinOpGrouped(c: *Context, node: Node, tag: std.zig.Ast.Node.Tag, tok_tag: TokenTag, bytes: []const u8) !NodeIndex { | 2501 | fn renderBinOpGrouped(c: *Context, node: Node, tag: std.zig.Ast.Node.Tag, tok_tag: TokenTag, bytes: []const u8) !NodeIndex { |
| 2502 | const payload = @fieldParentPtr(Payload.BinOp, "base", node.ptr_otherwise).data; | 2502 | const payload = @as(*Payload.BinOp, @alignCast(@fieldParentPtr(*align(1) Payload.BinOp, "base", node.ptr_otherwise))).data; |
| 2503 | const lhs = try renderNodeGrouped(c, payload.lhs); | 2503 | const lhs = try renderNodeGrouped(c, payload.lhs); |
| 2504 | return c.addNode(.{ | 2504 | return c.addNode(.{ |
| 2505 | .tag = tag, | 2505 | .tag = tag, |
| ... | @@ -2512,7 +2512,7 @@ fn renderBinOpGrouped(c: *Context, node: Node, tag: std.zig.Ast.Node.Tag, tok_ta | ... | @@ -2512,7 +2512,7 @@ fn renderBinOpGrouped(c: *Context, node: Node, tag: std.zig.Ast.Node.Tag, tok_ta |
| 2512 | } | 2512 | } |
| 2513 | 2513 | ||
| 2514 | fn renderBinOp(c: *Context, node: Node, tag: std.zig.Ast.Node.Tag, tok_tag: TokenTag, bytes: []const u8) !NodeIndex { | 2514 | fn renderBinOp(c: *Context, node: Node, tag: std.zig.Ast.Node.Tag, tok_tag: TokenTag, bytes: []const u8) !NodeIndex { |
| 2515 | const payload = @fieldParentPtr(Payload.BinOp, "base", node.ptr_otherwise).data; | 2515 | const payload = @as(*Payload.BinOp, @alignCast(@fieldParentPtr(*align(1) Payload.BinOp, "base", node.ptr_otherwise))).data; |
| 2516 | const lhs = try renderNode(c, payload.lhs); | 2516 | const lhs = try renderNode(c, payload.lhs); |
| 2517 | return c.addNode(.{ | 2517 | return c.addNode(.{ |
| 2518 | .tag = tag, | 2518 | .tag = tag, |
lib/std/Build.zig+2-2| ... | @@ -1062,8 +1062,8 @@ pub fn getUninstallStep(self: *Build) *Step { | ... | @@ -1062,8 +1062,8 @@ pub fn getUninstallStep(self: *Build) *Step { |
| 1062 | 1062 | ||
| 1063 | fn makeUninstall(uninstall_step: *Step, prog_node: *std.Progress.Node) anyerror!void { | 1063 | fn makeUninstall(uninstall_step: *Step, prog_node: *std.Progress.Node) anyerror!void { |
| 1064 | _ = prog_node; | 1064 | _ = prog_node; |
| 1065 | const uninstall_tls = @fieldParentPtr(TopLevelStep, "step", uninstall_step); | 1065 | const uninstall_tls = @fieldParentPtr(*TopLevelStep, "step", uninstall_step); |
| 1066 | const self = @fieldParentPtr(Build, "uninstall_tls", uninstall_tls); | 1066 | const self = @fieldParentPtr(*Build, "uninstall_tls", uninstall_tls); |
| 1067 | 1067 | ||
| 1068 | for (self.installed_files.items) |installed_file| { | 1068 | for (self.installed_files.items) |installed_file| { |
| 1069 | const full_path = self.getInstallPath(installed_file.dir, installed_file.path); | 1069 | const full_path = self.getInstallPath(installed_file.dir, installed_file.path); |
lib/std/Build/Step.zig+1-1| ... | @@ -231,7 +231,7 @@ fn makeNoOp(step: *Step, prog_node: *std.Progress.Node) anyerror!void { | ... | @@ -231,7 +231,7 @@ fn makeNoOp(step: *Step, prog_node: *std.Progress.Node) anyerror!void { |
| 231 | 231 | ||
| 232 | pub fn cast(step: *Step, comptime T: type) ?*T { | 232 | pub fn cast(step: *Step, comptime T: type) ?*T { |
| 233 | if (step.id == T.base_id) { | 233 | if (step.id == T.base_id) { |
| 234 | return @fieldParentPtr(T, "step", step); | 234 | return @fieldParentPtr(*T, "step", step); |
| 235 | } | 235 | } |
| 236 | return null; | 236 | return null; |
| 237 | } | 237 | } |
lib/std/Build/Step/CheckFile.zig+1-1| ... | @@ -49,7 +49,7 @@ pub fn setName(self: *CheckFile, name: []const u8) void { | ... | @@ -49,7 +49,7 @@ pub fn setName(self: *CheckFile, name: []const u8) void { |
| 49 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 49 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 50 | _ = prog_node; | 50 | _ = prog_node; |
| 51 | const b = step.owner; | 51 | const b = step.owner; |
| 52 | const self = @fieldParentPtr(CheckFile, "step", step); | 52 | const self = @fieldParentPtr(*CheckFile, "step", step); |
| 53 | 53 | ||
| 54 | const src_path = self.source.getPath(b); | 54 | const src_path = self.source.getPath(b); |
| 55 | const contents = fs.cwd().readFileAlloc(b.allocator, src_path, self.max_bytes) catch |err| { | 55 | const contents = fs.cwd().readFileAlloc(b.allocator, src_path, self.max_bytes) catch |err| { |
lib/std/Build/Step/CheckObject.zig+1-1| ... | @@ -530,7 +530,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { | ... | @@ -530,7 +530,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 530 | _ = prog_node; | 530 | _ = prog_node; |
| 531 | const b = step.owner; | 531 | const b = step.owner; |
| 532 | const gpa = b.allocator; | 532 | const gpa = b.allocator; |
| 533 | const self = @fieldParentPtr(CheckObject, "step", step); | 533 | const self = @fieldParentPtr(*CheckObject, "step", step); |
| 534 | 534 | ||
| 535 | const src_path = self.source.getPath(b); | 535 | const src_path = self.source.getPath(b); |
| 536 | const contents = fs.cwd().readFileAllocOptions( | 536 | const contents = fs.cwd().readFileAllocOptions( |
lib/std/Build/Step/Compile.zig+1-1| ... | @@ -918,7 +918,7 @@ fn getGeneratedFilePath(self: *Compile, comptime tag_name: []const u8, asking_st | ... | @@ -918,7 +918,7 @@ fn getGeneratedFilePath(self: *Compile, comptime tag_name: []const u8, asking_st |
| 918 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 918 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 919 | const b = step.owner; | 919 | const b = step.owner; |
| 920 | const arena = b.allocator; | 920 | const arena = b.allocator; |
| 921 | const self = @fieldParentPtr(Compile, "step", step); | 921 | const self = @fieldParentPtr(*Compile, "step", step); |
| 922 | 922 | ||
| 923 | var zig_args = ArrayList([]const u8).init(arena); | 923 | var zig_args = ArrayList([]const u8).init(arena); |
| 924 | defer zig_args.deinit(); | 924 | defer zig_args.deinit(); |
lib/std/Build/Step/ConfigHeader.zig+1-1| ... | @@ -167,7 +167,7 @@ fn putValue(self: *ConfigHeader, field_name: []const u8, comptime T: type, v: T) | ... | @@ -167,7 +167,7 @@ fn putValue(self: *ConfigHeader, field_name: []const u8, comptime T: type, v: T) |
| 167 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 167 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 168 | _ = prog_node; | 168 | _ = prog_node; |
| 169 | const b = step.owner; | 169 | const b = step.owner; |
| 170 | const self = @fieldParentPtr(ConfigHeader, "step", step); | 170 | const self = @fieldParentPtr(*ConfigHeader, "step", step); |
| 171 | const gpa = b.allocator; | 171 | const gpa = b.allocator; |
| 172 | const arena = b.allocator; | 172 | const arena = b.allocator; |
| 173 | 173 |
lib/std/Build/Step/Fmt.zig+1-1| ... | @@ -47,7 +47,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { | ... | @@ -47,7 +47,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 47 | 47 | ||
| 48 | const b = step.owner; | 48 | const b = step.owner; |
| 49 | const arena = b.allocator; | 49 | const arena = b.allocator; |
| 50 | const self = @fieldParentPtr(Fmt, "step", step); | 50 | const self = @fieldParentPtr(*Fmt, "step", step); |
| 51 | 51 | ||
| 52 | var argv: std.ArrayListUnmanaged([]const u8) = .{}; | 52 | var argv: std.ArrayListUnmanaged([]const u8) = .{}; |
| 53 | try argv.ensureUnusedCapacity(arena, 2 + 1 + self.paths.len + 2 * self.exclude_paths.len); | 53 | try argv.ensureUnusedCapacity(arena, 2 + 1 + self.paths.len + 2 * self.exclude_paths.len); |
lib/std/Build/Step/InstallArtifact.zig+1-1| ... | @@ -121,7 +121,7 @@ pub fn create(owner: *std.Build, artifact: *Step.Compile, options: Options) *Ins | ... | @@ -121,7 +121,7 @@ pub fn create(owner: *std.Build, artifact: *Step.Compile, options: Options) *Ins |
| 121 | 121 | ||
| 122 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 122 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 123 | _ = prog_node; | 123 | _ = prog_node; |
| 124 | const self = @fieldParentPtr(InstallArtifact, "step", step); | 124 | const self = @fieldParentPtr(*InstallArtifact, "step", step); |
| 125 | const dest_builder = step.owner; | 125 | const dest_builder = step.owner; |
| 126 | const cwd = fs.cwd(); | 126 | const cwd = fs.cwd(); |
| 127 | 127 |
lib/std/Build/Step/InstallDir.zig+1-1| ... | @@ -63,7 +63,7 @@ pub fn create(owner: *std.Build, options: Options) *InstallDirStep { | ... | @@ -63,7 +63,7 @@ pub fn create(owner: *std.Build, options: Options) *InstallDirStep { |
| 63 | 63 | ||
| 64 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 64 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 65 | _ = prog_node; | 65 | _ = prog_node; |
| 66 | const self = @fieldParentPtr(InstallDirStep, "step", step); | 66 | const self = @fieldParentPtr(*InstallDirStep, "step", step); |
| 67 | const dest_builder = self.dest_builder; | 67 | const dest_builder = self.dest_builder; |
| 68 | const arena = dest_builder.allocator; | 68 | const arena = dest_builder.allocator; |
| 69 | const dest_prefix = dest_builder.getInstallPath(self.options.install_dir, self.options.install_subdir); | 69 | const dest_prefix = dest_builder.getInstallPath(self.options.install_dir, self.options.install_subdir); |
lib/std/Build/Step/InstallFile.zig+1-1| ... | @@ -43,7 +43,7 @@ pub fn create( | ... | @@ -43,7 +43,7 @@ pub fn create( |
| 43 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 43 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 44 | _ = prog_node; | 44 | _ = prog_node; |
| 45 | const src_builder = step.owner; | 45 | const src_builder = step.owner; |
| 46 | const self = @fieldParentPtr(InstallFile, "step", step); | 46 | const self = @fieldParentPtr(*InstallFile, "step", step); |
| 47 | const dest_builder = self.dest_builder; | 47 | const dest_builder = self.dest_builder; |
| 48 | const full_src_path = self.source.getPath2(src_builder, step); | 48 | const full_src_path = self.source.getPath2(src_builder, step); |
| 49 | const full_dest_path = dest_builder.getInstallPath(self.dir, self.dest_rel_path); | 49 | const full_dest_path = dest_builder.getInstallPath(self.dir, self.dest_rel_path); |
lib/std/Build/Step/ObjCopy.zig+1-1| ... | @@ -92,7 +92,7 @@ pub fn getOutputSeparatedDebug(self: *const ObjCopy) ?std.Build.LazyPath { | ... | @@ -92,7 +92,7 @@ pub fn getOutputSeparatedDebug(self: *const ObjCopy) ?std.Build.LazyPath { |
| 92 | 92 | ||
| 93 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 93 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 94 | const b = step.owner; | 94 | const b = step.owner; |
| 95 | const self = @fieldParentPtr(ObjCopy, "step", step); | 95 | const self = @fieldParentPtr(*ObjCopy, "step", step); |
| 96 | 96 | ||
| 97 | var man = b.graph.cache.obtain(); | 97 | var man = b.graph.cache.obtain(); |
| 98 | defer man.deinit(); | 98 | defer man.deinit(); |
lib/std/Build/Step/Options.zig+1-1| ... | @@ -415,7 +415,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { | ... | @@ -415,7 +415,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 415 | _ = prog_node; | 415 | _ = prog_node; |
| 416 | 416 | ||
| 417 | const b = step.owner; | 417 | const b = step.owner; |
| 418 | const self = @fieldParentPtr(Options, "step", step); | 418 | const self = @fieldParentPtr(*Options, "step", step); |
| 419 | 419 | ||
| 420 | for (self.args.items) |item| { | 420 | for (self.args.items) |item| { |
| 421 | self.addOption( | 421 | self.addOption( |
lib/std/Build/Step/RemoveDir.zig+1-1| ... | @@ -28,7 +28,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { | ... | @@ -28,7 +28,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 28 | _ = prog_node; | 28 | _ = prog_node; |
| 29 | 29 | ||
| 30 | const b = step.owner; | 30 | const b = step.owner; |
| 31 | const self = @fieldParentPtr(RemoveDir, "step", step); | 31 | const self = @fieldParentPtr(*RemoveDir, "step", step); |
| 32 | 32 | ||
| 33 | b.build_root.handle.deleteTree(self.dir_path) catch |err| { | 33 | b.build_root.handle.deleteTree(self.dir_path) catch |err| { |
| 34 | if (b.build_root.path) |base| { | 34 | if (b.build_root.path) |base| { |
lib/std/Build/Step/Run.zig+1-1| ... | @@ -497,7 +497,7 @@ const IndexedOutput = struct { | ... | @@ -497,7 +497,7 @@ const IndexedOutput = struct { |
| 497 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 497 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 498 | const b = step.owner; | 498 | const b = step.owner; |
| 499 | const arena = b.allocator; | 499 | const arena = b.allocator; |
| 500 | const self = @fieldParentPtr(Run, "step", step); | 500 | const self = @fieldParentPtr(*Run, "step", step); |
| 501 | const has_side_effects = self.hasSideEffects(); | 501 | const has_side_effects = self.hasSideEffects(); |
| 502 | 502 | ||
| 503 | var argv_list = ArrayList([]const u8).init(arena); | 503 | var argv_list = ArrayList([]const u8).init(arena); |
lib/std/Build/Step/TranslateC.zig+1-1| ... | @@ -118,7 +118,7 @@ pub fn defineCMacroRaw(self: *TranslateC, name_and_value: []const u8) void { | ... | @@ -118,7 +118,7 @@ pub fn defineCMacroRaw(self: *TranslateC, name_and_value: []const u8) void { |
| 118 | 118 | ||
| 119 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 119 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 120 | const b = step.owner; | 120 | const b = step.owner; |
| 121 | const self = @fieldParentPtr(TranslateC, "step", step); | 121 | const self = @fieldParentPtr(*TranslateC, "step", step); |
| 122 | 122 | ||
| 123 | var argv_list = std.ArrayList([]const u8).init(b.allocator); | 123 | var argv_list = std.ArrayList([]const u8).init(b.allocator); |
| 124 | try argv_list.append(b.graph.zig_exe); | 124 | try argv_list.append(b.graph.zig_exe); |
lib/std/Build/Step/WriteFile.zig+1-1| ... | @@ -141,7 +141,7 @@ fn maybeUpdateName(wf: *WriteFile) void { | ... | @@ -141,7 +141,7 @@ fn maybeUpdateName(wf: *WriteFile) void { |
| 141 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 141 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 142 | _ = prog_node; | 142 | _ = prog_node; |
| 143 | const b = step.owner; | 143 | const b = step.owner; |
| 144 | const wf = @fieldParentPtr(WriteFile, "step", step); | 144 | const wf = @fieldParentPtr(*WriteFile, "step", step); |
| 145 | 145 | ||
| 146 | // Writing to source files is kind of an extra capability of this | 146 | // Writing to source files is kind of an extra capability of this |
| 147 | // WriteFile - arguably it should be a different step. But anyway here | 147 | // WriteFile - arguably it should be a different step. But anyway here |
lib/std/Thread/Pool.zig+2-2| ... | @@ -88,8 +88,8 @@ pub fn spawn(pool: *Pool, comptime func: anytype, args: anytype) !void { | ... | @@ -88,8 +88,8 @@ pub fn spawn(pool: *Pool, comptime func: anytype, args: anytype) !void { |
| 88 | run_node: RunQueue.Node = .{ .data = .{ .runFn = runFn } }, | 88 | run_node: RunQueue.Node = .{ .data = .{ .runFn = runFn } }, |
| 89 | 89 | ||
| 90 | fn runFn(runnable: *Runnable) void { | 90 | fn runFn(runnable: *Runnable) void { |
| 91 | const run_node = @fieldParentPtr(RunQueue.Node, "data", runnable); | 91 | const run_node = @fieldParentPtr(*RunQueue.Node, "data", runnable); |
| 92 | const closure = @fieldParentPtr(@This(), "run_node", run_node); | 92 | const closure = @fieldParentPtr(*@This(), "run_node", run_node); |
| 93 | @call(.auto, func, closure.arguments); | 93 | @call(.auto, func, closure.arguments); |
| 94 | 94 | ||
| 95 | // The thread pool's allocator is protected by the mutex. | 95 | // The thread pool's allocator is protected by the mutex. |
lib/std/http/Client.zig+1-1| ... | @@ -108,7 +108,7 @@ pub const ConnectionPool = struct { | ... | @@ -108,7 +108,7 @@ pub const ConnectionPool = struct { |
| 108 | pool.mutex.lock(); | 108 | pool.mutex.lock(); |
| 109 | defer pool.mutex.unlock(); | 109 | defer pool.mutex.unlock(); |
| 110 | 110 | ||
| 111 | const node = @fieldParentPtr(Node, "data", connection); | 111 | const node = @fieldParentPtr(*Node, "data", connection); |
| 112 | 112 | ||
| 113 | pool.used.remove(node); | 113 | pool.used.remove(node); |
| 114 | 114 |
lib/std/zig/AstGen.zig+3-3| ... | @@ -11686,20 +11686,20 @@ const Scope = struct { | ... | @@ -11686,20 +11686,20 @@ const Scope = struct { |
| 11686 | fn cast(base: *Scope, comptime T: type) ?*T { | 11686 | fn cast(base: *Scope, comptime T: type) ?*T { |
| 11687 | if (T == Defer) { | 11687 | if (T == Defer) { |
| 11688 | switch (base.tag) { | 11688 | switch (base.tag) { |
| 11689 | .defer_normal, .defer_error => return @fieldParentPtr(T, "base", base), | 11689 | .defer_normal, .defer_error => return @alignCast(@fieldParentPtr(*align(1) T, "base", base)), |
| 11690 | else => return null, | 11690 | else => return null, |
| 11691 | } | 11691 | } |
| 11692 | } | 11692 | } |
| 11693 | if (T == Namespace) { | 11693 | if (T == Namespace) { |
| 11694 | switch (base.tag) { | 11694 | switch (base.tag) { |
| 11695 | .namespace => return @fieldParentPtr(T, "base", base), | 11695 | .namespace => return @alignCast(@fieldParentPtr(*align(1) T, "base", base)), |
| 11696 | else => return null, | 11696 | else => return null, |
| 11697 | } | 11697 | } |
| 11698 | } | 11698 | } |
| 11699 | if (base.tag != T.base_tag) | 11699 | if (base.tag != T.base_tag) |
| 11700 | return null; | 11700 | return null; |
| 11701 | 11701 | ||
| 11702 | return @fieldParentPtr(T, "base", base); | 11702 | return @alignCast(@fieldParentPtr(*align(1) T, "base", base)); |
| 11703 | } | 11703 | } |
| 11704 | 11704 | ||
| 11705 | fn parent(base: *Scope) ?*Scope { | 11705 | fn parent(base: *Scope) ?*Scope { |
lib/std/zig/c_translation.zig+1-1| ... | @@ -414,7 +414,7 @@ pub const Macros = struct { | ... | @@ -414,7 +414,7 @@ pub const Macros = struct { |
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | pub fn WL_CONTAINER_OF(ptr: anytype, sample: anytype, comptime member: []const u8) @TypeOf(sample) { | 416 | pub fn WL_CONTAINER_OF(ptr: anytype, sample: anytype, comptime member: []const u8) @TypeOf(sample) { |
| 417 | return @fieldParentPtr(@TypeOf(sample.*), member, ptr); | 417 | return @fieldParentPtr(@TypeOf(sample), member, ptr); |
| 418 | } | 418 | } |
| 419 | 419 | ||
| 420 | /// A 2-argument function-like macro defined as #define FOO(A, B) (A)(B) | 420 | /// A 2-argument function-like macro defined as #define FOO(A, B) (A)(B) |
src/link.zig+23-23| ... | @@ -226,7 +226,7 @@ pub const File = struct { | ... | @@ -226,7 +226,7 @@ pub const File = struct { |
| 226 | if (base.tag != T.base_tag) | 226 | if (base.tag != T.base_tag) |
| 227 | return null; | 227 | return null; |
| 228 | 228 | ||
| 229 | return @fieldParentPtr(T, "base", base); | 229 | return @fieldParentPtr(*T, "base", base); |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | pub fn makeWritable(base: *File) !void { | 232 | pub fn makeWritable(base: *File) !void { |
| ... | @@ -383,7 +383,7 @@ pub const File = struct { | ... | @@ -383,7 +383,7 @@ pub const File = struct { |
| 383 | .c => unreachable, | 383 | .c => unreachable, |
| 384 | .nvptx => unreachable, | 384 | .nvptx => unreachable, |
| 385 | inline else => |t| { | 385 | inline else => |t| { |
| 386 | return @fieldParentPtr(t.Type(), "base", base).lowerUnnamedConst(val, decl_index); | 386 | return @fieldParentPtr(*t.Type(), "base", base).lowerUnnamedConst(val, decl_index); |
| 387 | }, | 387 | }, |
| 388 | } | 388 | } |
| 389 | } | 389 | } |
| ... | @@ -402,7 +402,7 @@ pub const File = struct { | ... | @@ -402,7 +402,7 @@ pub const File = struct { |
| 402 | .c => unreachable, | 402 | .c => unreachable, |
| 403 | .nvptx => unreachable, | 403 | .nvptx => unreachable, |
| 404 | inline else => |t| { | 404 | inline else => |t| { |
| 405 | return @fieldParentPtr(t.Type(), "base", base).getGlobalSymbol(name, lib_name); | 405 | return @fieldParentPtr(*t.Type(), "base", base).getGlobalSymbol(name, lib_name); |
| 406 | }, | 406 | }, |
| 407 | } | 407 | } |
| 408 | } | 408 | } |
| ... | @@ -413,11 +413,11 @@ pub const File = struct { | ... | @@ -413,11 +413,11 @@ pub const File = struct { |
| 413 | assert(decl.has_tv); | 413 | assert(decl.has_tv); |
| 414 | switch (base.tag) { | 414 | switch (base.tag) { |
| 415 | .c => { | 415 | .c => { |
| 416 | return @fieldParentPtr(C, "base", base).updateDecl(module, decl_index); | 416 | return @fieldParentPtr(*C, "base", base).updateDecl(module, decl_index); |
| 417 | }, | 417 | }, |
| 418 | inline else => |tag| { | 418 | inline else => |tag| { |
| 419 | if (build_options.only_c) unreachable; | 419 | if (build_options.only_c) unreachable; |
| 420 | return @fieldParentPtr(tag.Type(), "base", base).updateDecl(module, decl_index); | 420 | return @fieldParentPtr(*tag.Type(), "base", base).updateDecl(module, decl_index); |
| 421 | }, | 421 | }, |
| 422 | } | 422 | } |
| 423 | } | 423 | } |
| ... | @@ -432,11 +432,11 @@ pub const File = struct { | ... | @@ -432,11 +432,11 @@ pub const File = struct { |
| 432 | ) UpdateDeclError!void { | 432 | ) UpdateDeclError!void { |
| 433 | switch (base.tag) { | 433 | switch (base.tag) { |
| 434 | .c => { | 434 | .c => { |
| 435 | return @fieldParentPtr(C, "base", base).updateFunc(module, func_index, air, liveness); | 435 | return @fieldParentPtr(*C, "base", base).updateFunc(module, func_index, air, liveness); |
| 436 | }, | 436 | }, |
| 437 | inline else => |tag| { | 437 | inline else => |tag| { |
| 438 | if (build_options.only_c) unreachable; | 438 | if (build_options.only_c) unreachable; |
| 439 | return @fieldParentPtr(tag.Type(), "base", base).updateFunc(module, func_index, air, liveness); | 439 | return @fieldParentPtr(*tag.Type(), "base", base).updateFunc(module, func_index, air, liveness); |
| 440 | }, | 440 | }, |
| 441 | } | 441 | } |
| 442 | } | 442 | } |
| ... | @@ -447,11 +447,11 @@ pub const File = struct { | ... | @@ -447,11 +447,11 @@ pub const File = struct { |
| 447 | switch (base.tag) { | 447 | switch (base.tag) { |
| 448 | .spirv, .nvptx => {}, | 448 | .spirv, .nvptx => {}, |
| 449 | .c => { | 449 | .c => { |
| 450 | return @fieldParentPtr(C, "base", base).updateDeclLineNumber(module, decl_index); | 450 | return @fieldParentPtr(*C, "base", base).updateDeclLineNumber(module, decl_index); |
| 451 | }, | 451 | }, |
| 452 | inline else => |tag| { | 452 | inline else => |tag| { |
| 453 | if (build_options.only_c) unreachable; | 453 | if (build_options.only_c) unreachable; |
| 454 | return @fieldParentPtr(tag.Type(), "base", base).updateDeclLineNumber(module, decl_index); | 454 | return @fieldParentPtr(*tag.Type(), "base", base).updateDeclLineNumber(module, decl_index); |
| 455 | }, | 455 | }, |
| 456 | } | 456 | } |
| 457 | } | 457 | } |
| ... | @@ -473,11 +473,11 @@ pub const File = struct { | ... | @@ -473,11 +473,11 @@ pub const File = struct { |
| 473 | base.releaseLock(); | 473 | base.releaseLock(); |
| 474 | if (base.file) |f| f.close(); | 474 | if (base.file) |f| f.close(); |
| 475 | switch (base.tag) { | 475 | switch (base.tag) { |
| 476 | .c => @fieldParentPtr(C, "base", base).deinit(), | 476 | .c => @fieldParentPtr(*C, "base", base).deinit(), |
| 477 | 477 | ||
| 478 | inline else => |tag| { | 478 | inline else => |tag| { |
| 479 | if (build_options.only_c) unreachable; | 479 | if (build_options.only_c) unreachable; |
| 480 | @fieldParentPtr(tag.Type(), "base", base).deinit(); | 480 | @fieldParentPtr(*tag.Type(), "base", base).deinit(); |
| 481 | }, | 481 | }, |
| 482 | } | 482 | } |
| 483 | } | 483 | } |
| ... | @@ -560,7 +560,7 @@ pub const File = struct { | ... | @@ -560,7 +560,7 @@ pub const File = struct { |
| 560 | pub fn flush(base: *File, arena: Allocator, prog_node: *std.Progress.Node) FlushError!void { | 560 | pub fn flush(base: *File, arena: Allocator, prog_node: *std.Progress.Node) FlushError!void { |
| 561 | if (build_options.only_c) { | 561 | if (build_options.only_c) { |
| 562 | assert(base.tag == .c); | 562 | assert(base.tag == .c); |
| 563 | return @fieldParentPtr(C, "base", base).flush(arena, prog_node); | 563 | return @fieldParentPtr(*C, "base", base).flush(arena, prog_node); |
| 564 | } | 564 | } |
| 565 | const comp = base.comp; | 565 | const comp = base.comp; |
| 566 | if (comp.clang_preprocessor_mode == .yes or comp.clang_preprocessor_mode == .pch) { | 566 | if (comp.clang_preprocessor_mode == .yes or comp.clang_preprocessor_mode == .pch) { |
| ... | @@ -587,7 +587,7 @@ pub const File = struct { | ... | @@ -587,7 +587,7 @@ pub const File = struct { |
| 587 | } | 587 | } |
| 588 | switch (base.tag) { | 588 | switch (base.tag) { |
| 589 | inline else => |tag| { | 589 | inline else => |tag| { |
| 590 | return @fieldParentPtr(tag.Type(), "base", base).flush(arena, prog_node); | 590 | return @fieldParentPtr(*tag.Type(), "base", base).flush(arena, prog_node); |
| 591 | }, | 591 | }, |
| 592 | } | 592 | } |
| 593 | } | 593 | } |
| ... | @@ -597,11 +597,11 @@ pub const File = struct { | ... | @@ -597,11 +597,11 @@ pub const File = struct { |
| 597 | pub fn flushModule(base: *File, arena: Allocator, prog_node: *std.Progress.Node) FlushError!void { | 597 | pub fn flushModule(base: *File, arena: Allocator, prog_node: *std.Progress.Node) FlushError!void { |
| 598 | switch (base.tag) { | 598 | switch (base.tag) { |
| 599 | .c => { | 599 | .c => { |
| 600 | return @fieldParentPtr(C, "base", base).flushModule(arena, prog_node); | 600 | return @fieldParentPtr(*C, "base", base).flushModule(arena, prog_node); |
| 601 | }, | 601 | }, |
| 602 | inline else => |tag| { | 602 | inline else => |tag| { |
| 603 | if (build_options.only_c) unreachable; | 603 | if (build_options.only_c) unreachable; |
| 604 | return @fieldParentPtr(tag.Type(), "base", base).flushModule(arena, prog_node); | 604 | return @fieldParentPtr(*tag.Type(), "base", base).flushModule(arena, prog_node); |
| 605 | }, | 605 | }, |
| 606 | } | 606 | } |
| 607 | } | 607 | } |
| ... | @@ -610,11 +610,11 @@ pub const File = struct { | ... | @@ -610,11 +610,11 @@ pub const File = struct { |
| 610 | pub fn freeDecl(base: *File, decl_index: InternPool.DeclIndex) void { | 610 | pub fn freeDecl(base: *File, decl_index: InternPool.DeclIndex) void { |
| 611 | switch (base.tag) { | 611 | switch (base.tag) { |
| 612 | .c => { | 612 | .c => { |
| 613 | @fieldParentPtr(C, "base", base).freeDecl(decl_index); | 613 | @fieldParentPtr(*C, "base", base).freeDecl(decl_index); |
| 614 | }, | 614 | }, |
| 615 | inline else => |tag| { | 615 | inline else => |tag| { |
| 616 | if (build_options.only_c) unreachable; | 616 | if (build_options.only_c) unreachable; |
| 617 | @fieldParentPtr(tag.Type(), "base", base).freeDecl(decl_index); | 617 | @fieldParentPtr(*tag.Type(), "base", base).freeDecl(decl_index); |
| 618 | }, | 618 | }, |
| 619 | } | 619 | } |
| 620 | } | 620 | } |
| ... | @@ -636,11 +636,11 @@ pub const File = struct { | ... | @@ -636,11 +636,11 @@ pub const File = struct { |
| 636 | ) UpdateExportsError!void { | 636 | ) UpdateExportsError!void { |
| 637 | switch (base.tag) { | 637 | switch (base.tag) { |
| 638 | .c => { | 638 | .c => { |
| 639 | return @fieldParentPtr(C, "base", base).updateExports(module, exported, exports); | 639 | return @fieldParentPtr(*C, "base", base).updateExports(module, exported, exports); |
| 640 | }, | 640 | }, |
| 641 | inline else => |tag| { | 641 | inline else => |tag| { |
| 642 | if (build_options.only_c) unreachable; | 642 | if (build_options.only_c) unreachable; |
| 643 | return @fieldParentPtr(tag.Type(), "base", base).updateExports(module, exported, exports); | 643 | return @fieldParentPtr(*tag.Type(), "base", base).updateExports(module, exported, exports); |
| 644 | }, | 644 | }, |
| 645 | } | 645 | } |
| 646 | } | 646 | } |
| ... | @@ -664,7 +664,7 @@ pub const File = struct { | ... | @@ -664,7 +664,7 @@ pub const File = struct { |
| 664 | .spirv => unreachable, | 664 | .spirv => unreachable, |
| 665 | .nvptx => unreachable, | 665 | .nvptx => unreachable, |
| 666 | inline else => |tag| { | 666 | inline else => |tag| { |
| 667 | return @fieldParentPtr(tag.Type(), "base", base).getDeclVAddr(decl_index, reloc_info); | 667 | return @fieldParentPtr(*tag.Type(), "base", base).getDeclVAddr(decl_index, reloc_info); |
| 668 | }, | 668 | }, |
| 669 | } | 669 | } |
| 670 | } | 670 | } |
| ... | @@ -683,7 +683,7 @@ pub const File = struct { | ... | @@ -683,7 +683,7 @@ pub const File = struct { |
| 683 | .spirv => unreachable, | 683 | .spirv => unreachable, |
| 684 | .nvptx => unreachable, | 684 | .nvptx => unreachable, |
| 685 | inline else => |tag| { | 685 | inline else => |tag| { |
| 686 | return @fieldParentPtr(tag.Type(), "base", base).lowerAnonDecl(decl_val, decl_align, src_loc); | 686 | return @fieldParentPtr(*tag.Type(), "base", base).lowerAnonDecl(decl_val, decl_align, src_loc); |
| 687 | }, | 687 | }, |
| 688 | } | 688 | } |
| 689 | } | 689 | } |
| ... | @@ -695,7 +695,7 @@ pub const File = struct { | ... | @@ -695,7 +695,7 @@ pub const File = struct { |
| 695 | .spirv => unreachable, | 695 | .spirv => unreachable, |
| 696 | .nvptx => unreachable, | 696 | .nvptx => unreachable, |
| 697 | inline else => |tag| { | 697 | inline else => |tag| { |
| 698 | return @fieldParentPtr(tag.Type(), "base", base).getAnonDeclVAddr(decl_val, reloc_info); | 698 | return @fieldParentPtr(*tag.Type(), "base", base).getAnonDeclVAddr(decl_val, reloc_info); |
| 699 | }, | 699 | }, |
| 700 | } | 700 | } |
| 701 | } | 701 | } |
| ... | @@ -714,7 +714,7 @@ pub const File = struct { | ... | @@ -714,7 +714,7 @@ pub const File = struct { |
| 714 | => {}, | 714 | => {}, |
| 715 | 715 | ||
| 716 | inline else => |tag| { | 716 | inline else => |tag| { |
| 717 | return @fieldParentPtr(tag.Type(), "base", base).deleteDeclExport(decl_index, name); | 717 | return @fieldParentPtr(*tag.Type(), "base", base).deleteDeclExport(decl_index, name); |
| 718 | }, | 718 | }, |
| 719 | } | 719 | } |
| 720 | } | 720 | } |
src/link/tapi/parse.zig+9-9| ... | @@ -35,28 +35,28 @@ pub const Node = struct { | ... | @@ -35,28 +35,28 @@ pub const Node = struct { |
| 35 | if (self.tag != T.base_tag) { | 35 | if (self.tag != T.base_tag) { |
| 36 | return null; | 36 | return null; |
| 37 | } | 37 | } |
| 38 | return @fieldParentPtr(T, "base", self); | 38 | return @fieldParentPtr(*const T, "base", self); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | pub fn deinit(self: *Node, allocator: Allocator) void { | 41 | pub fn deinit(self: *Node, allocator: Allocator) void { |
| 42 | switch (self.tag) { | 42 | switch (self.tag) { |
| 43 | .doc => { | 43 | .doc => { |
| 44 | const parent = @fieldParentPtr(Node.Doc, "base", self); | 44 | const parent = @fieldParentPtr(*Node.Doc, "base", self); |
| 45 | parent.deinit(allocator); | 45 | parent.deinit(allocator); |
| 46 | allocator.destroy(parent); | 46 | allocator.destroy(parent); |
| 47 | }, | 47 | }, |
| 48 | .map => { | 48 | .map => { |
| 49 | const parent = @fieldParentPtr(Node.Map, "base", self); | 49 | const parent = @fieldParentPtr(*Node.Map, "base", self); |
| 50 | parent.deinit(allocator); | 50 | parent.deinit(allocator); |
| 51 | allocator.destroy(parent); | 51 | allocator.destroy(parent); |
| 52 | }, | 52 | }, |
| 53 | .list => { | 53 | .list => { |
| 54 | const parent = @fieldParentPtr(Node.List, "base", self); | 54 | const parent = @fieldParentPtr(*Node.List, "base", self); |
| 55 | parent.deinit(allocator); | 55 | parent.deinit(allocator); |
| 56 | allocator.destroy(parent); | 56 | allocator.destroy(parent); |
| 57 | }, | 57 | }, |
| 58 | .value => { | 58 | .value => { |
| 59 | const parent = @fieldParentPtr(Node.Value, "base", self); | 59 | const parent = @fieldParentPtr(*Node.Value, "base", self); |
| 60 | parent.deinit(allocator); | 60 | parent.deinit(allocator); |
| 61 | allocator.destroy(parent); | 61 | allocator.destroy(parent); |
| 62 | }, | 62 | }, |
| ... | @@ -70,10 +70,10 @@ pub const Node = struct { | ... | @@ -70,10 +70,10 @@ pub const Node = struct { |
| 70 | writer: anytype, | 70 | writer: anytype, |
| 71 | ) !void { | 71 | ) !void { |
| 72 | return switch (self.tag) { | 72 | return switch (self.tag) { |
| 73 | .doc => @fieldParentPtr(Node.Doc, "base", self).format(fmt, options, writer), | 73 | .doc => @fieldParentPtr(*Node.Doc, "base", self).format(fmt, options, writer), |
| 74 | .map => @fieldParentPtr(Node.Map, "base", self).format(fmt, options, writer), | 74 | .map => @fieldParentPtr(*Node.Map, "base", self).format(fmt, options, writer), |
| 75 | .list => @fieldParentPtr(Node.List, "base", self).format(fmt, options, writer), | 75 | .list => @fieldParentPtr(*Node.List, "base", self).format(fmt, options, writer), |
| 76 | .value => @fieldParentPtr(Node.Value, "base", self).format(fmt, options, writer), | 76 | .value => @fieldParentPtr(*Node.Value, "base", self).format(fmt, options, writer), |
| 77 | }; | 77 | }; |
| 78 | } | 78 | } |
| 79 | 79 |
src/register_manager.zig+1-1| ... | @@ -59,7 +59,7 @@ pub fn RegisterManager( | ... | @@ -59,7 +59,7 @@ pub fn RegisterManager( |
| 59 | pub const RegisterBitSet = StaticBitSet(tracked_registers.len); | 59 | pub const RegisterBitSet = StaticBitSet(tracked_registers.len); |
| 60 | 60 | ||
| 61 | fn getFunction(self: *Self) *Function { | 61 | fn getFunction(self: *Self) *Function { |
| 62 | return @fieldParentPtr(Function, "register_manager", self); | 62 | return @alignCast(@fieldParentPtr(*align(1) Function, "register_manager", self)); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | fn excludeRegister(reg: Register, register_class: RegisterBitSet) bool { | 65 | fn excludeRegister(reg: Register, register_class: RegisterBitSet) bool { |
test/standalone/cmakedefine/build.zig+1-1| ... | @@ -86,7 +86,7 @@ fn compare_headers(step: *std.Build.Step, prog_node: *std.Progress.Node) !void { | ... | @@ -86,7 +86,7 @@ fn compare_headers(step: *std.Build.Step, prog_node: *std.Progress.Node) !void { |
| 86 | const expected_fmt = "expected_{s}"; | 86 | const expected_fmt = "expected_{s}"; |
| 87 | 87 | ||
| 88 | for (step.dependencies.items) |config_header_step| { | 88 | for (step.dependencies.items) |config_header_step| { |
| 89 | const config_header = @fieldParentPtr(ConfigHeader, "step", config_header_step); | 89 | const config_header = @fieldParentPtr(*ConfigHeader, "step", config_header_step); |
| 90 | 90 | ||
| 91 | const zig_header_path = config_header.output_file.path orelse @panic("Could not locate header file"); | 91 | const zig_header_path = config_header.output_file.path orelse @panic("Could not locate header file"); |
| 92 | 92 |