diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2025-06-13 04:46:30 -0400 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2025-06-19 11:45:06 -0400 |
| commit | 917640810e7f3e18daff9e75b5ecefe761a1896c (patch) | |
| tree | 579e627d695f898d411a3cb1fbc0578d1a763cc2 /lib/std/Build/Module.zig | |
| parent | 16d78bc0c024da307c7ab5f6b94622e6b4b37397 (diff) | |
| download | zig-917640810e7f3e18daff9e75b5ecefe761a1896c.tar.gz zig-917640810e7f3e18daff9e75b5ecefe761a1896c.zip | |
Target: pass and use locals by pointer instead of by value
This struct is larger than 256 bytes and code that copies it
consistently shows up in profiles of the compiler.
Diffstat (limited to 'lib/std/Build/Module.zig')
| -rw-r--r-- | lib/std/Build/Module.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/Build/Module.zig b/lib/std/Build/Module.zig index 12b55a8c29..d9c098113f 100644 --- a/lib/std/Build/Module.zig +++ b/lib/std/Build/Module.zig @@ -655,10 +655,10 @@ fn linkLibraryOrObject(m: *Module, other: *Step.Compile) void { m.include_dirs.append(allocator, .{ .other_step = other }) catch @panic("OOM"); } -fn requireKnownTarget(m: *Module) std.Target { - const resolved_target = m.resolved_target orelse - @panic("this API requires the Module to be created with a known 'target' field"); - return resolved_target.result; +fn requireKnownTarget(m: *Module) *const std.Target { + const resolved_target = &(m.resolved_target orelse + @panic("this API requires the Module to be created with a known 'target' field")); + return &resolved_target.result; } /// Elements of `modules` and `names` are matched one-to-one. |
