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 {...@@ -1184,7 +1184,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
11841184
1185 // We put the `Compilation` itself in the arena. Freeing the arena will free the module.1185 // We put the `Compilation` itself in the arena. Freeing the arena will free the module.
1186 // It's initialized later after we prepare the initialization options.1186 // It's initialized later after we prepare the initialization options.
1187 const comp = try arena.create(Compilation);
1188 const root_name = try arena.dupeZ(u8, options.root_name);1187 const root_name = try arena.dupeZ(u8, options.root_name);
11891188
1190 const use_llvm = options.config.use_llvm;1189 const use_llvm = options.config.use_llvm;
...@@ -1280,7 +1279,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {...@@ -1280,7 +1279,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
1280 const sysroot = options.sysroot orelse libc_dirs.sysroot;1279 const sysroot = options.sysroot orelse libc_dirs.sysroot;
12811280
1282 const include_compiler_rt = options.want_compiler_rt orelse1281 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
1285 if (include_compiler_rt and output_mode == .Obj) {1284 if (include_compiler_rt and output_mode == .Obj) {
1286 // For objects, this mechanism relies on essentially `_ = @import("compiler-rt");`1285 // For objects, this mechanism relies on essentially `_ = @import("compiler-rt");`
...@@ -1357,7 +1356,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {...@@ -1357,7 +1356,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
1357 cache.hash.add(options.config.link_libcpp);1356 cache.hash.add(options.config.link_libcpp);
1358 cache.hash.add(options.config.link_libunwind);1357 cache.hash.add(options.config.link_libunwind);
1359 cache.hash.add(output_mode);1358 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);
1361 cache_helpers.addOptionalEmitLoc(&cache.hash, options.emit_bin);1360 cache_helpers.addOptionalEmitLoc(&cache.hash, options.emit_bin);
1362 cache_helpers.addOptionalEmitLoc(&cache.hash, options.emit_implib);1361 cache_helpers.addOptionalEmitLoc(&cache.hash, options.emit_implib);
1363 cache_helpers.addOptionalEmitLoc(&cache.hash, options.emit_docs);1362 cache_helpers.addOptionalEmitLoc(&cache.hash, options.emit_docs);
...@@ -1365,6 +1364,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {...@@ -1365,6 +1364,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
1365 cache.hash.add(options.config.wasi_exec_model);1364 cache.hash.add(options.config.wasi_exec_model);
1366 // TODO audit this and make sure everything is in it1365 // TODO audit this and make sure everything is in it
13671366
1367 const comp = try arena.create(Compilation);
1368 const opt_zcu: ?*Module = if (have_zcu) blk: {1368 const opt_zcu: ?*Module = if (have_zcu) blk: {
1369 // Pre-open the directory handles for cached ZIR code so that it does not need1369 // Pre-open the directory handles for cached ZIR code so that it does not need
1370 // to redundantly happen for each AstGen operation.1370 // to redundantly happen for each AstGen operation.