authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-03-19 12:27:20+01:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-03-30 20:50:48-04:00
loge409afb79bcadeabd2d5d4cc3cd5dcc54a964e94
treed09f9cc93ce8c44e5769e9124a0bd488a257345e
parent9b2345e182090e2f4c57e7684ec9739f195fdb1d

Update uses of `@fieldParentPtr` to pass a pointer type


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};
3838
39fn beforePreprocess(pragma: *Pragma, comp: *Compilation) void {39fn 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}
4343
44fn beforeParse(pragma: *Pragma, comp: *Compilation) void {44fn 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}
4949
50fn afterParse(pragma: *Pragma, comp: *Compilation) void {50fn 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}
6161
62fn deinit(pragma: *Pragma, comp: *Compilation) void {62fn 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}
109109
110fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pragma.Error!void {110fn 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;
114114
...@@ -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}
175175
176fn parserHandler(pragma: *Pragma, p: *Parser, start_idx: TokenIndex) Compilation.Error!void {176fn 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}
2323
24fn deinit(pragma: *Pragma, comp: *Compilation) void {24fn 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}
2828
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}
2828
29fn afterParse(pragma: *Pragma, _: *Compilation) void {29fn 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}
3333
34fn deinit(pragma: *Pragma, comp: *Compilation) void {34fn 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}
3939
40fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pragma.Error!void {40fn 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}
2525
26fn deinit(pragma: *Pragma, comp: *Compilation) void {26fn 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}
3131
32fn parserHandler(pragma: *Pragma, p: *Parser, start_idx: TokenIndex) Compilation.Error!void {32fn 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 }
11351135
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;
410410
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));
413413
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;
14961496
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}
20862086
2087fn renderRecord(c: *Context, node: Node) !NodeIndex {2087fn 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}
24882488
2489fn renderPrefixOp(c: *Context, node: Node, tag: std.zig.Ast.Node.Tag, tok_tag: TokenTag, bytes: []const u8) !NodeIndex {2489fn 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}
25002500
2501fn renderBinOpGrouped(c: *Context, node: Node, tag: std.zig.Ast.Node.Tag, tok_tag: TokenTag, bytes: []const u8) !NodeIndex {2501fn 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}
25132513
2514fn renderBinOp(c: *Context, node: Node, tag: std.zig.Ast.Node.Tag, tok_tag: TokenTag, bytes: []const u8) !NodeIndex {2514fn 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 {
10621062
1063fn makeUninstall(uninstall_step: *Step, prog_node: *std.Progress.Node) anyerror!void {1063fn 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);
10671067
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 {
231231
232pub fn cast(step: *Step, comptime T: type) ?*T {232pub 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 {
49fn make(step: *Step, prog_node: *std.Progress.Node) !void {49fn 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);
5353
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);
534534
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
918fn make(step: *Step, prog_node: *std.Progress.Node) !void {918fn 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);
922922
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)
167fn make(step: *Step, prog_node: *std.Progress.Node) !void {167fn 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;
173173
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 {
4747
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);
5151
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
121121
122fn make(step: *Step, prog_node: *std.Progress.Node) !void {122fn 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();
127127
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 {
6363
64fn make(step: *Step, prog_node: *std.Progress.Node) !void {64fn 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(
43fn make(step: *Step, prog_node: *std.Progress.Node) !void {43fn 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 {
9292
93fn make(step: *Step, prog_node: *std.Progress.Node) !void {93fn 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);
9696
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;
416416
417 const b = step.owner;417 const b = step.owner;
418 const self = @fieldParentPtr(Options, "step", step);418 const self = @fieldParentPtr(*Options, "step", step);
419419
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;
2929
30 const b = step.owner;30 const b = step.owner;
31 const self = @fieldParentPtr(RemoveDir, "step", step);31 const self = @fieldParentPtr(*RemoveDir, "step", step);
3232
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 {
497fn make(step: *Step, prog_node: *std.Progress.Node) !void {497fn 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();
502502
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 {
118118
119fn make(step: *Step, prog_node: *std.Progress.Node) !void {119fn 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);
122122
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 {
141fn make(step: *Step, prog_node: *std.Progress.Node) !void {141fn 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);
145145
146 // Writing to source files is kind of an extra capability of this146 // Writing to source files is kind of an extra capability of this
147 // WriteFile - arguably it should be a different step. But anyway here147 // 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 } },
8989
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);
9494
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();
110110
111 const node = @fieldParentPtr(Node, "data", connection);111 const node = @fieldParentPtr(*Node, "data", connection);
112112
113 pool.used.remove(node);113 pool.used.remove(node);
114114
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;
1170111701
11702 return @fieldParentPtr(T, "base", base);11702 return @alignCast(@fieldParentPtr(*align(1) T, "base", base));
11703 }11703 }
1170411704
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 }
415415
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 }
419419
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;
228228
229 return @fieldParentPtr(T, "base", base);229 return @fieldParentPtr(*T, "base", base);
230 }230 }
231231
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(),
477477
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 => {},
715715
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 }
4040
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 }
7979
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);
6060
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 }
6464
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}";
8787
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);
9090
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");
9292