compiler: audit debug mode checks

* Introduce `-Ddebug-extensions` for enabling compiler debug helpers
 * Replace safety mode checks with `std.debug.runtime_safety`
 * Replace debugger helper checks with `!builtin.strip_debug_info`

Sometimes, you just have to debug optimized compilers...
This commit is contained in:
Jacob Young
2024-03-01 16:46:48 +01:00
committed by Andrew Kelley
parent 155f5274ff
commit b60fc16b4f
19 changed files with 70 additions and 81 deletions

View File

@@ -3203,8 +3203,8 @@ pub fn ensureFuncBodyAnalyzed(zcu: *Zcu, func_index: InternPool.Index) SemaError
const comp = zcu.comp;
const dump_air = builtin.mode == .Debug and comp.verbose_air;
const dump_llvm_ir = builtin.mode == .Debug and (comp.verbose_llvm_ir != null or comp.verbose_llvm_bc != null);
const dump_air = build_options.enable_debug_extensions and comp.verbose_air;
const dump_llvm_ir = build_options.enable_debug_extensions and (comp.verbose_llvm_ir != null or comp.verbose_llvm_bc != null);
if (comp.bin_file == null and zcu.llvm_object == null and !dump_air and !dump_llvm_ir) {
return;