authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-04-10 16:36:21-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-04-10 18:35:14-07:00
logd2ad3f5074877475c8f0ec0fbbb323a05fe8cf78
treed0c1596c447d59c76db662db2362affd76ea90d3
parent23d7921758524f76f2157e6f8a5823da2511396a

std.Build.CompileStep: remove redundant dest_builder field

The destination *Build object is already known to be step.owner, while the source object is artifact.step.owner.

2 files changed, 3 insertions(+), 5 deletions(-)

lib/std/Build/CompileStep.zig+1-1
...@@ -533,7 +533,7 @@ pub fn installLibraryHeaders(cs: *CompileStep, l: *CompileStep) void {...@@ -533,7 +533,7 @@ pub fn installLibraryHeaders(cs: *CompileStep, l: *CompileStep) void {
533 const T = id.Type();533 const T = id.Type();
534 const ptr = b.allocator.create(T) catch @panic("OOM");534 const ptr = b.allocator.create(T) catch @panic("OOM");
535 ptr.* = step.cast(T).?.*;535 ptr.* = step.cast(T).?.*;
536 ptr.dest_builder = b;536 ptr.step.owner = b;
537 break :blk &ptr.step;537 break :blk &ptr.step;
538 },538 },
539 else => unreachable,539 else => unreachable,
lib/std/Build/InstallArtifactStep.zig+2-4
...@@ -8,7 +8,6 @@ const fs = std.fs;...@@ -8,7 +8,6 @@ const fs = std.fs;
8pub const base_id = .install_artifact;8pub const base_id = .install_artifact;
99
10step: Step,10step: Step,
11dest_builder: *std.Build,
12artifact: *CompileStep,11artifact: *CompileStep,
13dest_dir: InstallDir,12dest_dir: InstallDir,
14pdb_dir: ?InstallDir,13pdb_dir: ?InstallDir,
...@@ -28,7 +27,6 @@ pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep {...@@ -28,7 +27,6 @@ pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep {
28 .owner = owner,27 .owner = owner,
29 .makeFn = make,28 .makeFn = make,
30 }),29 }),
31 .dest_builder = owner,
32 .artifact = artifact,30 .artifact = artifact,
33 .dest_dir = artifact.override_dest_dir orelse switch (artifact.kind) {31 .dest_dir = artifact.override_dest_dir orelse switch (artifact.kind) {
34 .obj => @panic("Cannot install a .obj build artifact."),32 .obj => @panic("Cannot install a .obj build artifact."),
...@@ -71,9 +69,9 @@ pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep {...@@ -71,9 +69,9 @@ pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep {
7169
72fn make(step: *Step, prog_node: *std.Progress.Node) !void {70fn make(step: *Step, prog_node: *std.Progress.Node) !void {
73 _ = prog_node;71 _ = prog_node;
74 const src_builder = step.owner;
75 const self = @fieldParentPtr(InstallArtifactStep, "step", step);72 const self = @fieldParentPtr(InstallArtifactStep, "step", step);
76 const dest_builder = self.dest_builder;73 const src_builder = self.artifact.step.owner;
74 const dest_builder = step.owner;
7775
78 const dest_sub_path = if (self.dest_sub_path) |sub_path| sub_path else self.artifact.out_filename;76 const dest_sub_path = if (self.dest_sub_path) |sub_path| sub_path else self.artifact.out_filename;
79 const full_dest_path = dest_builder.getInstallPath(self.dest_dir, dest_sub_path);77 const full_dest_path = dest_builder.getInstallPath(self.dest_dir, dest_sub_path);