Commit d2ad3f5074

Andrew Kelley <andrew@ziglang.org>
2023-04-11 01:36:21
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.
1 parent 23d7921
Changed files (2)
lib/std/Build/CompileStep.zig
@@ -533,7 +533,7 @@ pub fn installLibraryHeaders(cs: *CompileStep, l: *CompileStep) void {
                 const T = id.Type();
                 const ptr = b.allocator.create(T) catch @panic("OOM");
                 ptr.* = step.cast(T).?.*;
-                ptr.dest_builder = b;
+                ptr.step.owner = b;
                 break :blk &ptr.step;
             },
             else => unreachable,
lib/std/Build/InstallArtifactStep.zig
@@ -8,7 +8,6 @@ const fs = std.fs;
 pub const base_id = .install_artifact;
 
 step: Step,
-dest_builder: *std.Build,
 artifact: *CompileStep,
 dest_dir: InstallDir,
 pdb_dir: ?InstallDir,
@@ -28,7 +27,6 @@ pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep {
             .owner = owner,
             .makeFn = make,
         }),
-        .dest_builder = owner,
         .artifact = artifact,
         .dest_dir = artifact.override_dest_dir orelse switch (artifact.kind) {
             .obj => @panic("Cannot install a .obj build artifact."),
@@ -71,9 +69,9 @@ pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep {
 
 fn make(step: *Step, prog_node: *std.Progress.Node) !void {
     _ = prog_node;
-    const src_builder = step.owner;
     const self = @fieldParentPtr(InstallArtifactStep, "step", step);
-    const dest_builder = self.dest_builder;
+    const src_builder = self.artifact.step.owner;
+    const dest_builder = step.owner;
 
     const dest_sub_path = if (self.dest_sub_path) |sub_path| sub_path else self.artifact.out_filename;
     const full_dest_path = dest_builder.getInstallPath(self.dest_dir, dest_sub_path);