authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-12-16 00:52:27-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-01 17:51:20-07:00
log971593647205da15f4174ddd7e4039b1c2756ccc
tree0896d607260569eac98b95e207d89c516800b210
parentb6dd5ad3578c69ad4a4b596477ccb86f087a99e6

Compilation: oops! used comp before init


1 files changed, 3 insertions(+), 3 deletions(-)

src/Compilation.zig+3-3
......@@ -1184,7 +1184,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
11841184
11851185 // We put the `Compilation` itself in the arena. Freeing the arena will free the module.
11861186 // It's initialized later after we prepare the initialization options.
1187 const comp = try arena.create(Compilation);
11881187 const root_name = try arena.dupeZ(u8, options.root_name);
11891188
11901189 const use_llvm = options.config.use_llvm;
......@@ -1280,7 +1279,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
12801279 const sysroot = options.sysroot orelse libc_dirs.sysroot;
12811280
12821281 const include_compiler_rt = options.want_compiler_rt orelse
1283 (!comp.skip_linker_dependencies and is_exe_or_dyn_lib);
1282 (!options.skip_linker_dependencies and is_exe_or_dyn_lib);
12841283
12851284 if (include_compiler_rt and output_mode == .Obj) {
12861285 // For objects, this mechanism relies on essentially `_ = @import("compiler-rt");`
......@@ -1357,7 +1356,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
13571356 cache.hash.add(options.config.link_libcpp);
13581357 cache.hash.add(options.config.link_libunwind);
13591358 cache.hash.add(output_mode);
1360 cache_helpers.addDebugFormat(&cache.hash, comp.config.debug_format);
1359 cache_helpers.addDebugFormat(&cache.hash, options.config.debug_format);
13611360 cache_helpers.addOptionalEmitLoc(&cache.hash, options.emit_bin);
13621361 cache_helpers.addOptionalEmitLoc(&cache.hash, options.emit_implib);
13631362 cache_helpers.addOptionalEmitLoc(&cache.hash, options.emit_docs);
......@@ -1365,6 +1364,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
13651364 cache.hash.add(options.config.wasi_exec_model);
13661365 // TODO audit this and make sure everything is in it
13671366
1367 const comp = try arena.create(Compilation);
13681368 const opt_zcu: ?*Module = if (have_zcu) blk: {
13691369 // Pre-open the directory handles for cached ZIR code so that it does not need
13701370 // to redundantly happen for each AstGen operation.