| author | |
| committer | |
| log | 845b6a8efe5ac71c9df02373fe3716814cb7b92d |
| tree | a74b61bdc6128b5d8f6a440bfc52318736d3b5c8 |
| parent | 95507faf1350f852174b43e6d6c2ea09339b8deb |
3 files changed, 5 insertions(+), 12 deletions(-)
src/Sema.zig+3-3| ... | ... | @@ -379,7 +379,7 @@ pub const Block = struct { |
| 379 | 379 | /// pop the error trace upon block exit. |
| 380 | 380 | error_return_trace_index: Air.Inst.Ref = .none, |
| 381 | 381 | |
| 382 | /// when null, it is determined by build mode, changed by @setRuntimeSafety | |
| 382 | /// when null, it is determined by the owner modules build mode, changed by @setRuntimeSafety | |
| 383 | 383 | want_safety: ?bool = null, |
| 384 | 384 | |
| 385 | 385 | /// What mode to generate float operations in, set by @setFloatMode |
| ... | ... | @@ -532,7 +532,7 @@ pub const Block = struct { |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | fn wantSafeTypes(block: *const Block) bool { |
| 535 | return block.want_safety orelse switch (block.sema.pt.zcu.optimizeMode()) { | |
| 535 | return block.want_safety orelse switch (block.ownerModule().optimize_mode) { | |
| 536 | 536 | .Debug => true, |
| 537 | 537 | .ReleaseSafe => true, |
| 538 | 538 | .ReleaseFast => false, |
| ... | ... | @@ -542,7 +542,7 @@ pub const Block = struct { |
| 542 | 542 | |
| 543 | 543 | fn wantSafety(block: *const Block) bool { |
| 544 | 544 | if (block.isComptime()) return false; // runtime safety checks are pointless in comptime blocks |
| 545 | return block.want_safety orelse switch (block.sema.pt.zcu.optimizeMode()) { | |
| 545 | return block.want_safety orelse switch (block.ownerModule().optimize_mode) { | |
| 546 | 546 | .Debug => true, |
| 547 | 547 | .ReleaseSafe => true, |
| 548 | 548 | .ReleaseFast => false, |
src/Zcu.zig-7| ... | ... | @@ -3908,13 +3908,6 @@ pub fn getTarget(zcu: *const Zcu) *const Target { |
| 3908 | 3908 | return &zcu.root_mod.resolved_target.result; |
| 3909 | 3909 | } |
| 3910 | 3910 | |
| 3911 | /// Deprecated. There is no global optimization mode for a Zig Compilation | |
| 3912 | /// Unit. Instead, look up the optimization mode based on the Module that | |
| 3913 | /// contains the source code being analyzed. | |
| 3914 | pub fn optimizeMode(zcu: *const Zcu) std.builtin.OptimizeMode { | |
| 3915 | return zcu.root_mod.optimize_mode; | |
| 3916 | } | |
| 3917 | ||
| 3918 | 3911 | pub fn handleUpdateExports( |
| 3919 | 3912 | zcu: *Zcu, |
| 3920 | 3913 | export_indices: []const Export.Index, |
src/codegen/c.zig+2-2| ... | ... | @@ -445,7 +445,7 @@ pub const Function = struct { |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | fn wantSafety(f: *Function) bool { |
| 448 | return switch (f.dg.pt.zcu.optimizeMode()) { | |
| 448 | return switch (f.dg.mod.optimize_mode) { | |
| 449 | 449 | .Debug, .ReleaseSafe => true, |
| 450 | 450 | .ReleaseFast, .ReleaseSmall => false, |
| 451 | 451 | }; |
| ... | ... | @@ -1301,7 +1301,7 @@ pub const DeclGen = struct { |
| 1301 | 1301 | else => .initializer, |
| 1302 | 1302 | }; |
| 1303 | 1303 | |
| 1304 | const safety_on = switch (zcu.optimizeMode()) { | |
| 1304 | const safety_on = switch (dg.mod.optimize_mode) { | |
| 1305 | 1305 | .Debug, .ReleaseSafe => true, |
| 1306 | 1306 | .ReleaseFast, .ReleaseSmall => false, |
| 1307 | 1307 | }; |