commit d2ad3f5074877475c8f0ec0fbbb323a05fe8cf78 (tree)
parent 23d7921758524f76f2157e6f8a5823da2511396a
Author: Andrew Kelley <andrew@ziglang.org>
Date: Mon, 10 Apr 2023 16:36:21 -0700
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.
Diffstat:
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/lib/std/Build/CompileStep.zig b/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,
diff --git a/lib/std/Build/InstallArtifactStep.zig b/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);