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 {
533533 const T = id.Type();
534534 const ptr = b.allocator.create(T) catch @panic("OOM");
535535 ptr.* = step.cast(T).?.*;
536 ptr.dest_builder = b;
536 ptr.step.owner = b;
537537 break :blk &ptr.step;
538538 },
539539 else => unreachable,
lib/std/Build/InstallArtifactStep.zig+2-4
......@@ -8,7 +8,6 @@ const fs = std.fs;
88pub const base_id = .install_artifact;
99
1010step: Step,
11dest_builder: *std.Build,
1211artifact: *CompileStep,
1312dest_dir: InstallDir,
1413pdb_dir: ?InstallDir,
......@@ -28,7 +27,6 @@ pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep {
2827 .owner = owner,
2928 .makeFn = make,
3029 }),
31 .dest_builder = owner,
3230 .artifact = artifact,
3331 .dest_dir = artifact.override_dest_dir orelse switch (artifact.kind) {
3432 .obj => @panic("Cannot install a .obj build artifact."),
......@@ -71,9 +69,9 @@ pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep {
7169
7270fn make(step: *Step, prog_node: *std.Progress.Node) !void {
7371 _ = prog_node;
74 const src_builder = step.owner;
7572 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
7876 const dest_sub_path = if (self.dest_sub_path) |sub_path| sub_path else self.artifact.out_filename;
7977 const full_dest_path = dest_builder.getInstallPath(self.dest_dir, dest_sub_path);