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.
This commit is contained in:
Andrew Kelley 2023-04-10 16:36:21 -07:00
parent 23d7921758
commit d2ad3f5074
2 changed files with 3 additions and 5 deletions

View File

@ -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,

View File

@ -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);