zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 971593647205da15f4174ddd7e4039b1c2756ccc (tree)
parent b6dd5ad3578c69ad4a4b596477ccb86f087a99e6
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Sat, 16 Dec 2023 00:52:27 -0700

Compilation: oops! used comp before init

Diffstat:
Msrc/Compilation.zig | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/Compilation.zig b/src/Compilation.zig @@ -1184,7 +1184,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { // We put the `Compilation` itself in the arena. Freeing the arena will free the module. // It's initialized later after we prepare the initialization options. - const comp = try arena.create(Compilation); const root_name = try arena.dupeZ(u8, options.root_name); const use_llvm = options.config.use_llvm; @@ -1280,7 +1279,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { const sysroot = options.sysroot orelse libc_dirs.sysroot; const include_compiler_rt = options.want_compiler_rt orelse - (!comp.skip_linker_dependencies and is_exe_or_dyn_lib); + (!options.skip_linker_dependencies and is_exe_or_dyn_lib); if (include_compiler_rt and output_mode == .Obj) { // For objects, this mechanism relies on essentially `_ = @import("compiler-rt");` @@ -1357,7 +1356,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { cache.hash.add(options.config.link_libcpp); cache.hash.add(options.config.link_libunwind); cache.hash.add(output_mode); - cache_helpers.addDebugFormat(&cache.hash, comp.config.debug_format); + cache_helpers.addDebugFormat(&cache.hash, options.config.debug_format); cache_helpers.addOptionalEmitLoc(&cache.hash, options.emit_bin); cache_helpers.addOptionalEmitLoc(&cache.hash, options.emit_implib); cache_helpers.addOptionalEmitLoc(&cache.hash, options.emit_docs); @@ -1365,6 +1364,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { cache.hash.add(options.config.wasi_exec_model); // TODO audit this and make sure everything is in it + const comp = try arena.create(Compilation); const opt_zcu: ?*Module = if (have_zcu) blk: { // Pre-open the directory handles for cached ZIR code so that it does not need // to redundantly happen for each AstGen operation.