authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-06-24 00:08:53-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-06-29 23:50:19-07:00
logb384a7f85859678657f0ee91041be27078dfd346
tree2c1c4f983074b916bdc8331a8613755528c63522
parent15204cc210e4010bfbd033f81aebad5df38bcde8

compiler: import Module instead of Package

it's almost like all these references to Package actually wanted to be references to Module instead...

25 files changed, 82 insertions(+), 84 deletions(-)

src/Builtin.zig+1-1
...@@ -370,7 +370,7 @@ const std = @import("std");...@@ -370,7 +370,7 @@ const std = @import("std");
370const Allocator = std.mem.Allocator;370const Allocator = std.mem.Allocator;
371const Cache = std.Build.Cache;371const Cache = std.Build.Cache;
372const build_options = @import("build_options");372const build_options = @import("build_options");
373const Module = @import("Package/Module.zig");373const Module = @import("Module.zig");
374const assert = std.debug.assert;374const assert = std.debug.assert;
375const AstGen = std.zig.AstGen;375const AstGen = std.zig.AstGen;
376const File = @import("Zcu.zig").File;376const File = @import("Zcu.zig").File;
src/Compilation.zig+24-24
...@@ -16,7 +16,6 @@ const fatal = std.process.fatal;...@@ -16,7 +16,6 @@ const fatal = std.process.fatal;
16const Value = @import("Value.zig");16const Value = @import("Value.zig");
17const Type = @import("Type.zig");17const Type = @import("Type.zig");
18const target_util = @import("target.zig");18const target_util = @import("target.zig");
19const Package = @import("Package.zig");
20const link = @import("link.zig");19const link = @import("link.zig");
21const tracy = @import("tracy.zig");20const tracy = @import("tracy.zig");
22const trace = tracy.trace;21const trace = tracy.trace;
...@@ -43,6 +42,7 @@ const Air = @import("Air.zig");...@@ -43,6 +42,7 @@ const Air = @import("Air.zig");
43const Builtin = @import("Builtin.zig");42const Builtin = @import("Builtin.zig");
44const LlvmObject = @import("codegen/llvm.zig").Object;43const LlvmObject = @import("codegen/llvm.zig").Object;
45const dev = @import("dev.zig");44const dev = @import("dev.zig");
45const Module = @import("Module.zig");
4646
47pub const Config = @import("Compilation/Config.zig");47pub const Config = @import("Compilation/Config.zig");
4848
...@@ -63,7 +63,7 @@ cache_use: CacheUse,...@@ -63,7 +63,7 @@ cache_use: CacheUse,
63/// All compilations have a root module because this is where some important63/// All compilations have a root module because this is where some important
64/// settings are stored, such as target and optimization mode. This module64/// settings are stored, such as target and optimization mode. This module
65/// might not have any .zig code associated with it, however.65/// might not have any .zig code associated with it, however.
66root_mod: *Package.Module,66root_mod: *Module,
6767
68/// User-specified settings that have all the defaults resolved into concrete values.68/// User-specified settings that have all the defaults resolved into concrete values.
69config: Config,69config: Config,
...@@ -766,7 +766,7 @@ pub const CrtFile = struct {...@@ -766,7 +766,7 @@ pub const CrtFile = struct {
766/// For passing to a C compiler.766/// For passing to a C compiler.
767pub const CSourceFile = struct {767pub const CSourceFile = struct {
768 /// Many C compiler flags are determined by settings contained in the owning Module.768 /// Many C compiler flags are determined by settings contained in the owning Module.
769 owner: *Package.Module,769 owner: *Module,
770 src_path: []const u8,770 src_path: []const u8,
771 extra_flags: []const []const u8 = &.{},771 extra_flags: []const []const u8 = &.{},
772 /// Same as extra_flags except they are not added to the Cache hash.772 /// Same as extra_flags except they are not added to the Cache hash.
...@@ -778,7 +778,7 @@ pub const CSourceFile = struct {...@@ -778,7 +778,7 @@ pub const CSourceFile = struct {
778778
779/// For passing to resinator.779/// For passing to resinator.
780pub const RcSourceFile = struct {780pub const RcSourceFile = struct {
781 owner: *Package.Module,781 owner: *Module,
782 src_path: []const u8,782 src_path: []const u8,
783 extra_flags: []const []const u8 = &.{},783 extra_flags: []const []const u8 = &.{},
784};784};
...@@ -1216,7 +1216,7 @@ pub const MiscError = struct {...@@ -1216,7 +1216,7 @@ pub const MiscError = struct {
1216};1216};
12171217
1218pub const cache_helpers = struct {1218pub const cache_helpers = struct {
1219 pub fn addModule(hh: *Cache.HashHelper, mod: *const Package.Module) void {1219 pub fn addModule(hh: *Cache.HashHelper, mod: *const Module) void {
1220 addResolvedTarget(hh, mod.resolved_target);1220 addResolvedTarget(hh, mod.resolved_target);
1221 hh.add(mod.optimize_mode);1221 hh.add(mod.optimize_mode);
1222 hh.add(mod.code_model);1222 hh.add(mod.code_model);
...@@ -1239,7 +1239,7 @@ pub const cache_helpers = struct {...@@ -1239,7 +1239,7 @@ pub const cache_helpers = struct {
12391239
1240 pub fn addResolvedTarget(1240 pub fn addResolvedTarget(
1241 hh: *Cache.HashHelper,1241 hh: *Cache.HashHelper,
1242 resolved_target: Package.Module.ResolvedTarget,1242 resolved_target: Module.ResolvedTarget,
1243 ) void {1243 ) void {
1244 const target = &resolved_target.result;1244 const target = &resolved_target.result;
1245 hh.add(target.cpu.arch);1245 hh.add(target.cpu.arch);
...@@ -1412,16 +1412,16 @@ pub const CreateOptions = struct {...@@ -1412,16 +1412,16 @@ pub const CreateOptions = struct {
1412 /// Options that have been resolved by calling `resolveDefaults`.1412 /// Options that have been resolved by calling `resolveDefaults`.
1413 config: Compilation.Config,1413 config: Compilation.Config,
14141414
1415 root_mod: *Package.Module,1415 root_mod: *Module,
1416 /// Normally, `main_mod` and `root_mod` are the same. The exception is `zig1416 /// Normally, `main_mod` and `root_mod` are the same. The exception is `zig
1417 /// test`, in which `root_mod` is the test runner, and `main_mod` is the1417 /// test`, in which `root_mod` is the test runner, and `main_mod` is the
1418 /// user's source file which has the tests.1418 /// user's source file which has the tests.
1419 main_mod: ?*Package.Module = null,1419 main_mod: ?*Module = null,
1420 /// This is provided so that the API user has a chance to tweak the1420 /// This is provided so that the API user has a chance to tweak the
1421 /// per-module settings of the standard library.1421 /// per-module settings of the standard library.
1422 /// When this is null, a default configuration of the std lib is created1422 /// When this is null, a default configuration of the std lib is created
1423 /// based on the settings of root_mod.1423 /// based on the settings of root_mod.
1424 std_mod: ?*Package.Module = null,1424 std_mod: ?*Module = null,
1425 root_name: []const u8,1425 root_name: []const u8,
1426 sysroot: ?[]const u8 = null,1426 sysroot: ?[]const u8 = null,
1427 cache_mode: CacheMode,1427 cache_mode: CacheMode,
...@@ -1763,7 +1763,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic,...@@ -1763,7 +1763,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic,
1763 if (compiler_rt_strat == .zcu) {1763 if (compiler_rt_strat == .zcu) {
1764 // For objects, this mechanism relies on essentially `_ = @import("compiler-rt");`1764 // For objects, this mechanism relies on essentially `_ = @import("compiler-rt");`
1765 // injected into the object.1765 // injected into the object.
1766 const compiler_rt_mod = Package.Module.create(arena, .{1766 const compiler_rt_mod = Module.create(arena, .{
1767 .paths = .{1767 .paths = .{
1768 .root = .zig_lib_root,1768 .root = .zig_lib_root,
1769 .root_src_path = "compiler_rt.zig",1769 .root_src_path = "compiler_rt.zig",
...@@ -1825,7 +1825,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic,...@@ -1825,7 +1825,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic,
1825 };1825 };
18261826
1827 if (ubsan_rt_strat == .zcu) {1827 if (ubsan_rt_strat == .zcu) {
1828 const ubsan_rt_mod = Package.Module.create(arena, .{1828 const ubsan_rt_mod = Module.create(arena, .{
1829 .paths = .{1829 .paths = .{
1830 .root = .zig_lib_root,1830 .root = .zig_lib_root,
1831 .root_src_path = "ubsan_rt.zig",1831 .root_src_path = "ubsan_rt.zig",
...@@ -1866,7 +1866,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic,...@@ -1866,7 +1866,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic,
1866 };1866 };
18671867
1868 if (zigc_strat == .zcu) {1868 if (zigc_strat == .zcu) {
1869 const zigc_mod = Package.Module.create(arena, .{1869 const zigc_mod = Module.create(arena, .{
1870 .paths = .{1870 .paths = .{
1871 .root = .zig_lib_root,1871 .root = .zig_lib_root,
1872 .root_src_path = "c.zig",1872 .root_src_path = "c.zig",
...@@ -1996,7 +1996,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic,...@@ -1996,7 +1996,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic,
1996 .path = try options.dirs.global_cache.join(arena, &.{zir_sub_dir}),1996 .path = try options.dirs.global_cache.join(arena, &.{zir_sub_dir}),
1997 };1997 };
19981998
1999 const std_mod = options.std_mod orelse Package.Module.create(arena, .{1999 const std_mod = options.std_mod orelse Module.create(arena, .{
2000 .paths = .{2000 .paths = .{
2001 .root = try .fromRoot(arena, options.dirs, .zig_lib, "std"),2001 .root = try .fromRoot(arena, options.dirs, .zig_lib, "std"),
2002 .root_src_path = "std.zig",2002 .root_src_path = "std.zig",
...@@ -4639,7 +4639,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void {...@@ -4639,7 +4639,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void {
4639 var buffer: [1024]u8 = undefined;4639 var buffer: [1024]u8 = undefined;
4640 var tar_file_writer = tar_file.writer(io, &buffer);4640 var tar_file_writer = tar_file.writer(io, &buffer);
46414641
4642 var seen_table: std.array_hash_map.Auto(*Package.Module, []const u8) = .empty;4642 var seen_table: std.array_hash_map.Auto(*Module, []const u8) = .empty;
4643 defer seen_table.deinit(comp.gpa);4643 defer seen_table.deinit(comp.gpa);
46444644
4645 try seen_table.put(comp.gpa, zcu.main_mod, comp.root_name);4645 try seen_table.put(comp.gpa, zcu.main_mod, comp.root_name);
...@@ -4666,7 +4666,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void {...@@ -4666,7 +4666,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void {
46664666
4667fn docsCopyModule(4667fn docsCopyModule(
4668 comp: *Compilation,4668 comp: *Compilation,
4669 module: *Package.Module,4669 module: *Module,
4670 name: []const u8,4670 name: []const u8,
4671 tar_file_writer: *Io.File.Writer,4671 tar_file_writer: *Io.File.Writer,
4672) !void {4672) !void {
...@@ -4746,7 +4746,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) SubU...@@ -4746,7 +4746,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) SubU
47464746
4747 const optimize_mode = std.lang.OptimizeMode.ReleaseSmall;4747 const optimize_mode = std.lang.OptimizeMode.ReleaseSmall;
4748 const output_mode = std.lang.OutputMode.Exe;4748 const output_mode = std.lang.OutputMode.Exe;
4749 const resolved_target: Package.Module.ResolvedTarget = .{4749 const resolved_target: Module.ResolvedTarget = .{
4750 .result = std.zig.system.resolveTargetQuery(io, .{4750 .result = std.zig.system.resolveTargetQuery(io, .{
4751 .cpu_arch = .wasm32,4751 .cpu_arch = .wasm32,
4752 .os_tag = .freestanding,4752 .os_tag = .freestanding,
...@@ -4786,7 +4786,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) SubU...@@ -4786,7 +4786,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) SubU
47864786
4787 const dirs = comp.dirs.withoutLocalCache();4787 const dirs = comp.dirs.withoutLocalCache();
47884788
4789 const root_mod = Package.Module.create(arena, .{4789 const root_mod = Module.create(arena, .{
4790 .paths = .{4790 .paths = .{
4791 .root = try .fromRoot(arena, dirs, .zig_lib, "docs/wasm"),4791 .root = try .fromRoot(arena, dirs, .zig_lib, "docs/wasm"),
4792 .root_src_path = src_basename,4792 .root_src_path = src_basename,
...@@ -4803,7 +4803,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) SubU...@@ -4803,7 +4803,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) SubU
4803 comp.lockAndSetMiscFailure(.docs_wasm, "sub-compilation of docs_wasm failed: failed to create root module: {t}", .{err});4803 comp.lockAndSetMiscFailure(.docs_wasm, "sub-compilation of docs_wasm failed: failed to create root module: {t}", .{err});
4804 return error.AlreadyReported;4804 return error.AlreadyReported;
4805 };4805 };
4806 const walk_mod = Package.Module.create(arena, .{4806 const walk_mod = Module.create(arena, .{
4807 .paths = .{4807 .paths = .{
4808 .root = try .fromRoot(arena, dirs, .zig_lib, "docs/wasm"),4808 .root = try .fromRoot(arena, dirs, .zig_lib, "docs/wasm"),
4809 .root_src_path = "Walk.zig",4809 .root_src_path = "Walk.zig",
...@@ -4888,7 +4888,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) SubU...@@ -4888,7 +4888,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) SubU
48884888
4889pub fn obtainCObjectCacheManifest(4889pub fn obtainCObjectCacheManifest(
4890 comp: *const Compilation,4890 comp: *const Compilation,
4891 owner_mod: *Package.Module,4891 owner_mod: *Module,
4892) Cache.Manifest {4892) Cache.Manifest {
4893 var man = comp.cache_parent.obtain();4893 var man = comp.cache_parent.obtain();
48944894
...@@ -4936,7 +4936,7 @@ pub fn translateC(...@@ -4936,7 +4936,7 @@ pub fn translateC(
4936 ext: FileExt,4936 ext: FileExt,
4937 source_path: []const u8,4937 source_path: []const u8,
4938 translated_basename: []const u8,4938 translated_basename: []const u8,
4939 owner_mod: *Package.Module,4939 owner_mod: *Module,
4940 prog_node: std.Progress.Node,4940 prog_node: std.Progress.Node,
4941 environ_map: *const std.process.Environ.Map,4941 environ_map: *const std.process.Environ.Map,
4942) !TranslateCResult {4942) !TranslateCResult {
...@@ -6092,7 +6092,7 @@ fn addCommonCCArgs(...@@ -6092,7 +6092,7 @@ fn addCommonCCArgs(
6092 argv: *std.array_list.Managed([]const u8),6092 argv: *std.array_list.Managed([]const u8),
6093 ext: FileExt,6093 ext: FileExt,
6094 out_dep_path: ?[]const u8,6094 out_dep_path: ?[]const u8,
6095 mod: *Package.Module,6095 mod: *Module,
6096 c_frontend: Config.CFrontend,6096 c_frontend: Config.CFrontend,
6097) !void {6097) !void {
6098 const target = &mod.resolved_target.result;6098 const target = &mod.resolved_target.result;
...@@ -6446,7 +6446,7 @@ pub fn addCCArgs(...@@ -6446,7 +6446,7 @@ pub fn addCCArgs(
6446 argv: *std.array_list.Managed([]const u8),6446 argv: *std.array_list.Managed([]const u8),
6447 ext: FileExt,6447 ext: FileExt,
6448 out_dep_path: ?[]const u8,6448 out_dep_path: ?[]const u8,
6449 mod: *Package.Module,6449 mod: *Module,
6450) !void {6450) !void {
6451 const target = &mod.resolved_target.result;6451 const target = &mod.resolved_target.result;
64526452
...@@ -7237,7 +7237,7 @@ fn buildOutputFromZig(...@@ -7237,7 +7237,7 @@ fn buildOutputFromZig(
7237 return error.AlreadyReported;7237 return error.AlreadyReported;
7238 };7238 };
72397239
7240 const root_mod = Package.Module.create(arena, .{7240 const root_mod = Module.create(arena, .{
7241 .paths = .{7241 .paths = .{
7242 .root = .zig_lib_root,7242 .root = .zig_lib_root,
7243 .root_src_path = src_basename,7243 .root_src_path = src_basename,
...@@ -7384,7 +7384,7 @@ pub fn build_crt_file(...@@ -7384,7 +7384,7 @@ pub fn build_crt_file(
7384 comp.lockAndSetMiscFailure(misc_task_tag, "sub-compilation of {t} failed: failed to resolve compilation config: {t}", .{ misc_task_tag, err });7384 comp.lockAndSetMiscFailure(misc_task_tag, "sub-compilation of {t} failed: failed to resolve compilation config: {t}", .{ misc_task_tag, err });
7385 return error.AlreadyReported;7385 return error.AlreadyReported;
7386 };7386 };
7387 const root_mod = Package.Module.create(arena, .{7387 const root_mod = Module.create(arena, .{
7388 .paths = .{7388 .paths = .{
7389 .root = .zig_lib_root,7389 .root = .zig_lib_root,
7390 .root_src_path = "",7390 .root_src_path = "",
src/Compilation/Config.zig+1-1
...@@ -577,7 +577,7 @@ pub fn resolve(options: Options) ResolveError!Config {...@@ -577,7 +577,7 @@ pub fn resolve(options: Options) ResolveError!Config {
577}577}
578578
579const std = @import("std");579const std = @import("std");
580const Module = @import("../Package.zig").Module;580const Module = @import("../Module.zig");
581const Config = @This();581const Config = @This();
582const target_util = @import("../target.zig");582const target_util = @import("../target.zig");
583const build_options = @import("build_options");583const build_options = @import("build_options");
src/Module.zig+4-4
...@@ -6,10 +6,10 @@ const Allocator = std.mem.Allocator;...@@ -6,10 +6,10 @@ const Allocator = std.mem.Allocator;
6const Cache = std.Build.Cache;6const Cache = std.Build.Cache;
7const assert = std.debug.assert;7const assert = std.debug.assert;
88
9const target_util = @import("../target.zig");9const target_util = @import("target.zig");
10const Builtin = @import("../Builtin.zig");10const Builtin = @import("Builtin.zig");
11const Compilation = @import("../Compilation.zig");11const Compilation = @import("Compilation.zig");
12const File = @import("../Zcu.zig").File;12const File = @import("Zcu.zig").File;
1313
14/// The root directory of the module. Only files inside this directory can be imported.14/// The root directory of the module. Only files inside this directory can be imported.
15root: Compilation.Path,15root: Compilation.Path,
src/Sema.zig+2-2
...@@ -25,7 +25,6 @@ const SemaError = Zcu.SemaError;...@@ -25,7 +25,6 @@ const SemaError = Zcu.SemaError;
25const LazySrcLoc = Zcu.LazySrcLoc;25const LazySrcLoc = Zcu.LazySrcLoc;
26const RangeSet = @import("RangeSet.zig");26const RangeSet = @import("RangeSet.zig");
27const target_util = @import("target.zig");27const target_util = @import("target.zig");
28const Package = @import("Package.zig");
29const crash_report = @import("crash_report.zig");28const crash_report = @import("crash_report.zig");
30const build_options = @import("build_options");29const build_options = @import("build_options");
31const Compilation = @import("Compilation.zig");30const Compilation = @import("Compilation.zig");
...@@ -36,6 +35,7 @@ const ComptimeAllocIndex = InternPool.ComptimeAllocIndex;...@@ -36,6 +35,7 @@ const ComptimeAllocIndex = InternPool.ComptimeAllocIndex;
36const Cache = std.Build.Cache;35const Cache = std.Build.Cache;
37const LowerZon = @import("Sema/LowerZon.zig");36const LowerZon = @import("Sema/LowerZon.zig");
38const arith = @import("Sema/arith.zig");37const arith = @import("Sema/arith.zig");
38const Module = @import("Module.zig");
3939
40pt: Zcu.PerThread,40pt: Zcu.PerThread,
41/// Alias to `zcu.gpa`.41/// Alias to `zcu.gpa`.
...@@ -839,7 +839,7 @@ pub const Block = struct {...@@ -839,7 +839,7 @@ pub const Block = struct {
839 return result_index;839 return result_index;
840 }840 }
841841
842 pub fn ownerModule(block: Block) *Package.Module {842 pub fn ownerModule(block: Block) *Module {
843 const zcu = block.sema.pt.zcu;843 const zcu = block.sema.pt.zcu;
844 return zcu.namespacePtr(block.namespace).fileScope(zcu).mod.?;844 return zcu.namespacePtr(block.namespace).fileScope(zcu).mod.?;
845 }845 }
src/Zcu.zig+15-15
...@@ -25,7 +25,7 @@ const Compilation = @import("Compilation.zig");...@@ -25,7 +25,7 @@ const Compilation = @import("Compilation.zig");
25const Cache = std.Build.Cache;25const Cache = std.Build.Cache;
26pub const Value = @import("Value.zig");26pub const Value = @import("Value.zig");
27pub const Type = @import("Type.zig");27pub const Type = @import("Type.zig");
28const Package = @import("Package.zig");28const Module = @import("Module.zig");
29const link = @import("link.zig");29const link = @import("link.zig");
30const Air = @import("Air.zig");30const Air = @import("Air.zig");
31const Zir = std.zig.Zir;31const Zir = std.zig.Zir;
...@@ -64,11 +64,11 @@ comp: *Compilation,...@@ -64,11 +64,11 @@ comp: *Compilation,
64llvm_object: ?LlvmObject.Ptr,64llvm_object: ?LlvmObject.Ptr,
6565
66/// Pointer to externally managed resource.66/// Pointer to externally managed resource.
67root_mod: *Package.Module,67root_mod: *Module,
68/// Normally, `main_mod` and `root_mod` are the same. The exception is `zig test`, in which68/// Normally, `main_mod` and `root_mod` are the same. The exception is `zig test`, in which
69/// `root_mod` is the test runner, and `main_mod` is the user's source file which has the tests.69/// `root_mod` is the test runner, and `main_mod` is the user's source file which has the tests.
70main_mod: *Package.Module,70main_mod: *Module,
71std_mod: *Package.Module,71std_mod: *Module,
72sema_prog_node: std.Progress.Node = .none,72sema_prog_node: std.Progress.Node = .none,
73codegen_prog_node: std.Progress.Node = .none,73codegen_prog_node: std.Progress.Node = .none,
74/// The number of codegen jobs which are pending or in-progress. Whichever thread drops this value74/// The number of codegen jobs which are pending or in-progress. Whichever thread drops this value
...@@ -105,11 +105,11 @@ multi_exports: std.array_hash_map.Auto(AnalUnit, extern struct {...@@ -105,11 +105,11 @@ multi_exports: std.array_hash_map.Auto(AnalUnit, extern struct {
105}) = .{},105}) = .{},
106106
107/// Key is the digest returned by `Builtin.hash`; value is the corresponding module.107/// Key is the digest returned by `Builtin.hash`; value is the corresponding module.
108builtin_modules: std.array_hash_map.Auto(Cache.BinDigest, *Package.Module) = .empty,108builtin_modules: std.array_hash_map.Auto(Cache.BinDigest, *Module) = .empty,
109109
110/// Populated as soon as the `Compilation` is created. Guaranteed to contain all modules, even builtin ones.110/// Populated as soon as the `Compilation` is created. Guaranteed to contain all modules, even builtin ones.
111/// Modules whose root file is not a Zig or ZON file have the value `.none`.111/// Modules whose root file is not a Zig or ZON file have the value `.none`.
112module_roots: std.array_hash_map.Auto(*Package.Module, File.Index.Optional) = .empty,112module_roots: std.array_hash_map.Auto(*Module, File.Index.Optional) = .empty,
113113
114/// The set of all the Zig source files in the Zig Compilation Unit. Tracked in114/// The set of all the Zig source files in the Zig Compilation Unit. Tracked in
115/// order to iterate over it and check which source files have been modified on115/// order to iterate over it and check which source files have been modified on
...@@ -148,7 +148,7 @@ alive_files: std.array_hash_map.Auto(File.Index, File.Reference) = .empty,...@@ -148,7 +148,7 @@ alive_files: std.array_hash_map.Auto(File.Index, File.Reference) = .empty,
148/// Cleared and recomputed every update, after AstGen and before Sema.148/// Cleared and recomputed every update, after AstGen and before Sema.
149multi_module_err: ?struct {149multi_module_err: ?struct {
150 file: File.Index,150 file: File.Index,
151 modules: [2]*Package.Module,151 modules: [2]*Module,
152 refs: [2]File.Reference,152 refs: [2]File.Reference,
153} = null,153} = null,
154154
...@@ -292,7 +292,7 @@ retryable_failures: std.ArrayList(AnalUnit) = .empty,...@@ -292,7 +292,7 @@ retryable_failures: std.ArrayList(AnalUnit) = .empty,
292292
293/// These are the modules which we initially queue for analysis in `Compilation.update`.293/// These are the modules which we initially queue for analysis in `Compilation.update`.
294/// `resolveReferences` will use these as the root of its reachability traversal.294/// `resolveReferences` will use these as the root of its reachability traversal.
295analysis_roots_buffer: [5]*Package.Module,295analysis_roots_buffer: [5]*Module,
296analysis_roots_len: usize = 0,296analysis_roots_len: usize = 0,
297/// This is the cached result of `Zcu.resolveReferences`. It is computed on-demand, and297/// This is the cached result of `Zcu.resolveReferences`. It is computed on-demand, and
298/// reset to `null` when any semantic analysis occurs (since this invalidates the data).298/// reset to `null` when any semantic analysis occurs (since this invalidates the data).
...@@ -985,7 +985,7 @@ pub const File = struct {...@@ -985,7 +985,7 @@ pub const File = struct {
985 /// tell, and invalidate dependencies as needed (see `module_changed`).985 /// tell, and invalidate dependencies as needed (see `module_changed`).
986 /// During semantic analysis, this is always non-`null` for alive files (i.e. those which986 /// During semantic analysis, this is always non-`null` for alive files (i.e. those which
987 /// have imports targeting them).987 /// have imports targeting them).
988 mod: ?*Package.Module,988 mod: ?*Module,
989 /// Relative to the root directory of `mod`. If `mod == null`, this field is `undefined`.989 /// Relative to the root directory of `mod`. If `mod == null`, this field is `undefined`.
990 /// This memory is managed externally and must not be directly freed.990 /// This memory is managed externally and must not be directly freed.
991 /// Its lifetime is at least equal to that of this `File`.991 /// Its lifetime is at least equal to that of this `File`.
...@@ -1028,13 +1028,13 @@ pub const File = struct {...@@ -1028,13 +1028,13 @@ pub const File = struct {
10281028
1029 /// A single reference to a file.1029 /// A single reference to a file.
1030 pub const Reference = union(enum) {1030 pub const Reference = union(enum) {
1031 analysis_root: *Package.Module,1031 analysis_root: *Module,
1032 import: struct {1032 import: struct {
1033 importer: Zcu.File.Index,1033 importer: Zcu.File.Index,
1034 tok: Ast.TokenIndex,1034 tok: Ast.TokenIndex,
1035 /// If the file is imported as the root of a module, this is that module.1035 /// If the file is imported as the root of a module, this is that module.
1036 /// `null` means the file was imported directly by path.1036 /// `null` means the file was imported directly by path.
1037 module: ?*Package.Module,1037 module: ?*Module,
1038 },1038 },
1039 };1039 };
10401040
...@@ -3709,7 +3709,7 @@ pub const ImportResult = struct {...@@ -3709,7 +3709,7 @@ pub const ImportResult = struct {
3709 /// If this import was a simple file path, this is `null`; the imported file should exist within3709 /// If this import was a simple file path, this is `null`; the imported file should exist within
3710 /// the importer's module. Otherwise, it's the module which the import resolved to. This module3710 /// the importer's module. Otherwise, it's the module which the import resolved to. This module
3711 /// could match the module of `cur_file`, since a module can depend on itself.3711 /// could match the module of `cur_file`, since a module can depend on itself.
3712 module: ?*Package.Module,3712 module: ?*Module,
3713};3713};
37143714
3715/// Prepares `unit` for re-analysis by clearing all of the following state:3715/// Prepares `unit` for re-analysis by clearing all of the following state:
...@@ -4406,7 +4406,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana...@@ -4406,7 +4406,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana
4406 return units.move();4406 return units.move();
4407}4407}
44084408
4409pub fn analysisRoots(zcu: *Zcu) []*Package.Module {4409pub fn analysisRoots(zcu: *Zcu) []*Module {
4410 return zcu.analysis_roots_buffer[0..zcu.analysis_roots_len];4410 return zcu.analysis_roots_buffer[0..zcu.analysis_roots_len];
4411}4411}
44124412
...@@ -4820,7 +4820,7 @@ fn explainWhyFileIsInModule(...@@ -4820,7 +4820,7 @@ fn explainWhyFileIsInModule(
4820 eb: *std.zig.ErrorBundle.Wip,4820 eb: *std.zig.ErrorBundle.Wip,
4821 notes_out: *std.ArrayList(std.zig.ErrorBundle.MessageIndex),4821 notes_out: *std.ArrayList(std.zig.ErrorBundle.MessageIndex),
4822 file: File.Index,4822 file: File.Index,
4823 in_module: *Package.Module,4823 in_module: *Module,
4824 ref: File.Reference,4824 ref: File.Reference,
4825) Allocator.Error!void {4825) Allocator.Error!void {
4826 const gpa = zcu.gpa;4826 const gpa = zcu.gpa;
...@@ -4866,7 +4866,7 @@ fn explainWhyFileIsInModule(...@@ -4866,7 +4866,7 @@ fn explainWhyFileIsInModule(
4866 const import_src = try importer_file.errorBundleTokenSrc(import.tok, zcu, eb);4866 const import_src = try importer_file.errorBundleTokenSrc(import.tok, zcu, eb);
48674867
4868 const importer_ref = zcu.alive_files.get(import.importer).?;4868 const importer_ref = zcu.alive_files.get(import.importer).?;
4869 const importer_root: ?*Package.Module = switch (importer_ref) {4869 const importer_root: ?*Module = switch (importer_ref) {
4870 .analysis_root => |mod| mod,4870 .analysis_root => |mod| mod,
4871 .import => |i| i.module,4871 .import => |i| i.module,
4872 };4872 };
src/Zcu/PerThread.zig+1-1
...@@ -23,7 +23,7 @@ const builtin = @import("builtin");...@@ -23,7 +23,7 @@ const builtin = @import("builtin");
23const dev = @import("../dev.zig");23const dev = @import("../dev.zig");
24const InternPool = @import("../InternPool.zig");24const InternPool = @import("../InternPool.zig");
25const AnalUnit = InternPool.AnalUnit;25const AnalUnit = InternPool.AnalUnit;
26const Module = @import("../Package.zig").Module;26const Module = @import("../Module.zig");
27const Sema = @import("../Sema.zig");27const Sema = @import("../Sema.zig");
28const target_util = @import("../target.zig");28const target_util = @import("../target.zig");
29const tracy = @import("../tracy.zig");29const tracy = @import("../tracy.zig");
src/codegen/aarch64/Select.zig+2-2
...@@ -7592,7 +7592,7 @@ pub fn layout(...@@ -7592,7 +7592,7 @@ pub fn layout(
7592 is_sysv_var_args: bool,7592 is_sysv_var_args: bool,
7593 saved_gra_len: u7,7593 saved_gra_len: u7,
7594 saved_vra_len: u7,7594 saved_vra_len: u7,
7595 mod: *const Package.Module,7595 mod: *const Module,
7596) !usize {7596) !usize {
7597 const zcu = isel.pt.zcu;7597 const zcu = isel.pt.zcu;
7598 const ip = &zcu.intern_pool;7598 const ip = &zcu.intern_pool;
...@@ -12513,7 +12513,7 @@ const assert = std.debug.assert;...@@ -12513,7 +12513,7 @@ const assert = std.debug.assert;
12513const codegen = @import("../../codegen.zig");12513const codegen = @import("../../codegen.zig");
12514const Constant = @import("../../Value.zig");12514const Constant = @import("../../Value.zig");
12515const InternPool = @import("../../InternPool.zig");12515const InternPool = @import("../../InternPool.zig");
12516const Package = @import("../../Package.zig");12516const Module = @import("../../Module.zig");
12517const Register = codegen.aarch64.encoding.Register;12517const Register = codegen.aarch64.encoding.Register;
12518const Select = @This();12518const Select = @This();
12519const std = @import("std");12519const std = @import("std");
src/codegen/c.zig+1-1
...@@ -9,7 +9,7 @@ const Writer = std.Io.Writer;...@@ -9,7 +9,7 @@ const Writer = std.Io.Writer;
9const dev = @import("../dev.zig");9const dev = @import("../dev.zig");
10const link = @import("../link.zig");10const link = @import("../link.zig");
11const Zcu = @import("../Zcu.zig");11const Zcu = @import("../Zcu.zig");
12const Module = @import("../Package/Module.zig");12const Module = @import("../Module.zig");
13const Compilation = @import("../Compilation.zig");13const Compilation = @import("../Compilation.zig");
14const Value = @import("../Value.zig");14const Value = @import("../Value.zig");
15const Type = @import("../Type.zig");15const Type = @import("../Type.zig");
src/codegen/llvm.zig+2-2
...@@ -13,7 +13,7 @@ const Compilation = @import("../Compilation.zig");...@@ -13,7 +13,7 @@ const Compilation = @import("../Compilation.zig");
13const dev = @import("../dev.zig");13const dev = @import("../dev.zig");
14const InternPool = @import("../InternPool.zig");14const InternPool = @import("../InternPool.zig");
15const link = @import("../link.zig");15const link = @import("../link.zig");
16const Package = @import("../Package.zig");16const Module = @import("../Module.zig");
17const target_util = @import("../target.zig");17const target_util = @import("../target.zig");
18const Type = @import("../Type.zig");18const Type = @import("../Type.zig");
19const Value = @import("../Value.zig");19const Value = @import("../Value.zig");
...@@ -2772,7 +2772,7 @@ pub const Object = struct {...@@ -2772,7 +2772,7 @@ pub const Object = struct {
2772 fn addCommonFnAttributes(2772 fn addCommonFnAttributes(
2773 o: *Object,2773 o: *Object,
2774 attributes: *Builder.FunctionAttributes.Wip,2774 attributes: *Builder.FunctionAttributes.Wip,
2775 owner_mod: *Package.Module,2775 owner_mod: *Module,
2776 omit_frame_pointer: bool,2776 omit_frame_pointer: bool,
2777 ) Allocator.Error!void {2777 ) Allocator.Error!void {
2778 if (!owner_mod.red_zone) {2778 if (!owner_mod.red_zone) {
src/codegen/llvm/FuncGen.zig+2-2
...@@ -80,7 +80,7 @@ fn todo(fg: *FuncGen, comptime format: []const u8, args: anytype) TodoError {...@@ -80,7 +80,7 @@ fn todo(fg: *FuncGen, comptime format: []const u8, args: anytype) TodoError {
80 );80 );
81}81}
8282
83fn ownerModule(fg: *const FuncGen) *Package.Module {83fn ownerModule(fg: *const FuncGen) *Module {
84 return fg.object.zcu.navFileScope(fg.nav_index).mod.?;84 return fg.object.zcu.navFileScope(fg.nav_index).mod.?;
85}85}
8686
...@@ -7739,7 +7739,7 @@ const mips_c_abi = @import("../mips/abi.zig");...@@ -7739,7 +7739,7 @@ const mips_c_abi = @import("../mips/abi.zig");
77397739
7740const Zcu = @import("../../Zcu.zig");7740const Zcu = @import("../../Zcu.zig");
7741const Air = @import("../../Air.zig");7741const Air = @import("../../Air.zig");
7742const Package = @import("../../Package.zig");7742const Module = @import("../../Module.zig");
7743const InternPool = @import("../../InternPool.zig");7743const InternPool = @import("../../InternPool.zig");
7744const Value = @import("../../Value.zig");7744const Value = @import("../../Value.zig");
7745const Type = @import("../../Type.zig");7745const Type = @import("../../Type.zig");
src/codegen/riscv64/CodeGen.zig+2-2
...@@ -14,7 +14,7 @@ const Type = @import("../../Type.zig");...@@ -14,7 +14,7 @@ const Type = @import("../../Type.zig");
14const Value = @import("../../Value.zig");14const Value = @import("../../Value.zig");
15const link = @import("../../link.zig");15const link = @import("../../link.zig");
16const Zcu = @import("../../Zcu.zig");16const Zcu = @import("../../Zcu.zig");
17const Package = @import("../../Package.zig");17const Module = @import("../../Module.zig");
18const InternPool = @import("../../InternPool.zig");18const InternPool = @import("../../InternPool.zig");
19const Compilation = @import("../../Compilation.zig");19const Compilation = @import("../../Compilation.zig");
20const target_util = @import("../../target.zig");20const target_util = @import("../../target.zig");
...@@ -66,7 +66,7 @@ liveness: Air.Liveness,...@@ -66,7 +66,7 @@ liveness: Air.Liveness,
66bin_file: *link.File,66bin_file: *link.File,
67gpa: Allocator,67gpa: Allocator,
6868
69mod: *Package.Module,69mod: *Module,
70target: *const std.Target,70target: *const std.Target,
71args: []MCValue,71args: []MCValue,
72ret_mcv: InstTracking,72ret_mcv: InstTracking,
src/codegen/x86_64/CodeGen.zig+1-1
...@@ -14,7 +14,7 @@ const Emit = @import("Emit.zig");...@@ -14,7 +14,7 @@ const Emit = @import("Emit.zig");
14const Lower = @import("Lower.zig");14const Lower = @import("Lower.zig");
15const Mir = @import("Mir.zig");15const Mir = @import("Mir.zig");
16const Zcu = @import("../../Zcu.zig");16const Zcu = @import("../../Zcu.zig");
17const Module = @import("../../Package/Module.zig");17const Module = @import("../../Module.zig");
18const InternPool = @import("../../InternPool.zig");18const InternPool = @import("../../InternPool.zig");
19const Type = @import("../../Type.zig");19const Type = @import("../../Type.zig");
20const Value = @import("../../Value.zig");20const Value = @import("../../Value.zig");
src/libs/freebsd.zig+1-1
...@@ -12,7 +12,7 @@ const Compilation = @import("../Compilation.zig");...@@ -12,7 +12,7 @@ const Compilation = @import("../Compilation.zig");
12const build_options = @import("build_options");12const build_options = @import("build_options");
13const trace = @import("../tracy.zig").trace;13const trace = @import("../tracy.zig").trace;
14const Cache = std.Build.Cache;14const Cache = std.Build.Cache;
15const Module = @import("../Package/Module.zig");15const Module = @import("../Module.zig");
16const link = @import("../link.zig");16const link = @import("../link.zig");
1717
18pub const CrtFile = enum {18pub const CrtFile = enum {
src/libs/glibc.zig+1-1
...@@ -12,7 +12,7 @@ const Compilation = @import("../Compilation.zig");...@@ -12,7 +12,7 @@ const Compilation = @import("../Compilation.zig");
12const build_options = @import("build_options");12const build_options = @import("build_options");
13const trace = @import("../tracy.zig").trace;13const trace = @import("../tracy.zig").trace;
14const Cache = std.Build.Cache;14const Cache = std.Build.Cache;
15const Module = @import("../Package/Module.zig");15const Module = @import("../Module.zig");
16const link = @import("../link.zig");16const link = @import("../link.zig");
1717
18pub const Lib = struct {18pub const Lib = struct {
src/libs/libcxx.zig+1-1
...@@ -6,7 +6,7 @@ const target_util = @import("../target.zig");...@@ -6,7 +6,7 @@ const target_util = @import("../target.zig");
6const Compilation = @import("../Compilation.zig");6const Compilation = @import("../Compilation.zig");
7const build_options = @import("build_options");7const build_options = @import("build_options");
8const trace = @import("../tracy.zig").trace;8const trace = @import("../tracy.zig").trace;
9const Module = @import("../Package/Module.zig");9const Module = @import("../Module.zig");
1010
11const libcxxabi_files = [_][]const u8{11const libcxxabi_files = [_][]const u8{
12 "src/cxa_aux_runtime.cpp",12 "src/cxa_aux_runtime.cpp",
src/libs/libtsan.zig+1-1
...@@ -4,7 +4,7 @@ const assert = std.debug.assert;...@@ -4,7 +4,7 @@ const assert = std.debug.assert;
4const Compilation = @import("../Compilation.zig");4const Compilation = @import("../Compilation.zig");
5const build_options = @import("build_options");5const build_options = @import("build_options");
6const trace = @import("../tracy.zig").trace;6const trace = @import("../tracy.zig").trace;
7const Module = @import("../Package/Module.zig");7const Module = @import("../Module.zig");
88
9pub const BuildError = error{9pub const BuildError = error{
10 OutOfMemory,10 OutOfMemory,
src/libs/libunwind.zig+1-1
...@@ -4,7 +4,7 @@ const assert = std.debug.assert;...@@ -4,7 +4,7 @@ const assert = std.debug.assert;
44
5const target_util = @import("../target.zig");5const target_util = @import("../target.zig");
6const Compilation = @import("../Compilation.zig");6const Compilation = @import("../Compilation.zig");
7const Module = @import("../Package/Module.zig");7const Module = @import("../Module.zig");
8const build_options = @import("build_options");8const build_options = @import("build_options");
9const trace = @import("../tracy.zig").trace;9const trace = @import("../tracy.zig").trace;
1010
src/libs/musl.zig+1-1
...@@ -3,7 +3,7 @@ const Allocator = std.mem.Allocator;...@@ -3,7 +3,7 @@ const Allocator = std.mem.Allocator;
3const mem = std.mem;3const mem = std.mem;
4const path = std.fs.path;4const path = std.fs.path;
5const assert = std.debug.assert;5const assert = std.debug.assert;
6const Module = @import("../Package/Module.zig");6const Module = @import("../Module.zig");
77
8const Compilation = @import("../Compilation.zig");8const Compilation = @import("../Compilation.zig");
9const build_options = @import("build_options");9const build_options = @import("build_options");
src/libs/netbsd.zig+1-1
...@@ -12,7 +12,7 @@ const Compilation = @import("../Compilation.zig");...@@ -12,7 +12,7 @@ const Compilation = @import("../Compilation.zig");
12const build_options = @import("build_options");12const build_options = @import("build_options");
13const trace = @import("../tracy.zig").trace;13const trace = @import("../tracy.zig").trace;
14const Cache = std.Build.Cache;14const Cache = std.Build.Cache;
15const Module = @import("../Package/Module.zig");15const Module = @import("../Module.zig");
16const link = @import("../link.zig");16const link = @import("../link.zig");
1717
18pub const CrtFile = enum {18pub const CrtFile = enum {
src/libs/openbsd.zig+1-1
...@@ -13,7 +13,7 @@ const Compilation = @import("../Compilation.zig");...@@ -13,7 +13,7 @@ const Compilation = @import("../Compilation.zig");
13const build_options = @import("build_options");13const build_options = @import("build_options");
14const trace = @import("../tracy.zig").trace;14const trace = @import("../tracy.zig").trace;
15const Cache = std.Build.Cache;15const Cache = std.Build.Cache;
16const Module = @import("../Package/Module.zig");16const Module = @import("../Module.zig");
17const link = @import("../link.zig");17const link = @import("../link.zig");
1818
19pub const CrtFile = enum {19pub const CrtFile = enum {
src/link.zig-1
...@@ -21,7 +21,6 @@ const Zcu = @import("Zcu.zig");...@@ -21,7 +21,6 @@ const Zcu = @import("Zcu.zig");
21const InternPool = @import("InternPool.zig");21const InternPool = @import("InternPool.zig");
22const Type = @import("Type.zig");22const Type = @import("Type.zig");
23const Value = @import("Value.zig");23const Value = @import("Value.zig");
24const Package = @import("Package.zig");
25const dev = @import("dev.zig");24const dev = @import("dev.zig");
26const target_util = @import("target.zig");25const target_util = @import("target.zig");
27const codegen = @import("codegen.zig");26const codegen = @import("codegen.zig");
src/link/C.zig+1-1
...@@ -13,7 +13,7 @@ const Path = std.Build.Cache.Path;...@@ -13,7 +13,7 @@ const Path = std.Build.Cache.Path;
1313
14const build_options = @import("build_options");14const build_options = @import("build_options");
15const Zcu = @import("../Zcu.zig");15const Zcu = @import("../Zcu.zig");
16const Module = @import("../Package/Module.zig");16const Module = @import("../Module.zig");
17const InternPool = @import("../InternPool.zig");17const InternPool = @import("../InternPool.zig");
18const Alignment = InternPool.Alignment;18const Alignment = InternPool.Alignment;
19const Compilation = @import("../Compilation.zig");19const Compilation = @import("../Compilation.zig");
src/link/Dwarf.zig+1-1
...@@ -10,7 +10,7 @@ const log = std.log.scoped(.dwarf);...@@ -10,7 +10,7 @@ const log = std.log.scoped(.dwarf);
10const Writer = std.Io.Writer;10const Writer = std.Io.Writer;
1111
12const InternPool = @import("../InternPool.zig");12const InternPool = @import("../InternPool.zig");
13const Module = @import("../Package.zig").Module;13const Module = @import("../Module.zig");
14const Type = @import("../Type.zig");14const Type = @import("../Type.zig");
15const Value = @import("../Value.zig");15const Value = @import("../Value.zig");
16const Zcu = @import("../Zcu.zig");16const Zcu = @import("../Zcu.zig");
src/main.zig+14-15
...@@ -26,7 +26,6 @@ const allocPrint = std.fmt.allocPrint;...@@ -26,7 +26,6 @@ const allocPrint = std.fmt.allocPrint;
26pub const tracy = @import("tracy.zig");26pub const tracy = @import("tracy.zig");
27const Compilation = @import("Compilation.zig");27const Compilation = @import("Compilation.zig");
28const link = @import("link.zig");28const link = @import("link.zig");
29const Package = @import("Package.zig");
30const build_options = @import("build_options");29const build_options = @import("build_options");
31const wasi_libc = @import("libs/wasi_libc.zig");30const wasi_libc = @import("libs/wasi_libc.zig");
32const target_util = @import("target.zig");31const target_util = @import("target.zig");
...@@ -34,9 +33,9 @@ const crash_report = @import("crash_report.zig");...@@ -34,9 +33,9 @@ const crash_report = @import("crash_report.zig");
34const Zcu = @import("Zcu.zig");33const Zcu = @import("Zcu.zig");
35const mingw = @import("libs/mingw.zig");34const mingw = @import("libs/mingw.zig");
36const dev = @import("dev.zig");35const dev = @import("dev.zig");
36const Module = @import("Module.zig");
3737
38test {38test {
39 _ = Package;
40 _ = @import("codegen.zig");39 _ = @import("codegen.zig");
41}40}
4241
...@@ -878,13 +877,13 @@ const CliModule = struct {...@@ -878,13 +877,13 @@ const CliModule = struct {
878 root_path: []const u8,877 root_path: []const u8,
879 root_src_path: []const u8,878 root_src_path: []const u8,
880 cc_argv: []const []const u8,879 cc_argv: []const []const u8,
881 inherited: Package.Module.CreateOptions.Inherited,880 inherited: Module.CreateOptions.Inherited,
882 target_arch_os_abi: ?[]const u8,881 target_arch_os_abi: ?[]const u8,
883 target_mcpu: ?[]const u8,882 target_mcpu: ?[]const u8,
884 dynamic_linker: ?[]const u8,883 dynamic_linker: ?[]const u8,
885884
886 deps: []const Dep,885 deps: []const Dep,
887 resolved: ?*Package.Module,886 resolved: ?*Module,
888887
889 c_source_files_start: usize,888 c_source_files_start: usize,
890 c_source_files_end: usize,889 c_source_files_end: usize,
...@@ -1035,7 +1034,7 @@ fn buildOutputType(...@@ -1035,7 +1034,7 @@ fn buildOutputType(
10351034
1036 // These get set by CLI flags and then snapshotted when a `-M` flag is1035 // These get set by CLI flags and then snapshotted when a `-M` flag is
1037 // encountered.1036 // encountered.
1038 var mod_opts: Package.Module.CreateOptions.Inherited = .{};1037 var mod_opts: Module.CreateOptions.Inherited = .{};
10391038
1040 // These get appended to by CLI flags and then slurped when a `-M` flag1039 // These get appended to by CLI flags and then slurped when a `-M` flag
1041 // is encountered.1040 // is encountered.
...@@ -3266,7 +3265,7 @@ fn buildOutputType(...@@ -3266,7 +3265,7 @@ fn buildOutputType(
3266 const root_mod = switch (arg_mode) {3265 const root_mod = switch (arg_mode) {
3267 .zig_test, .zig_test_obj => root_mod: {3266 .zig_test, .zig_test_obj => root_mod: {
3268 const test_mod = if (test_runner_path) |test_runner| test_mod: {3267 const test_mod = if (test_runner_path) |test_runner| test_mod: {
3269 const test_mod = try Package.Module.create(arena, .{3268 const test_mod = try Module.create(arena, .{
3270 .paths = .{3269 .paths = .{
3271 .root = try .fromUnresolved(arena, dirs, &.{fs.path.dirname(test_runner) orelse "."}),3270 .root = try .fromUnresolved(arena, dirs, &.{fs.path.dirname(test_runner) orelse "."}),
3272 .root_src_path = fs.path.basename(test_runner),3271 .root_src_path = fs.path.basename(test_runner),
...@@ -3279,7 +3278,7 @@ fn buildOutputType(...@@ -3279,7 +3278,7 @@ fn buildOutputType(
3279 });3278 });
3280 test_mod.deps = try main_mod.deps.clone(arena);3279 test_mod.deps = try main_mod.deps.clone(arena);
3281 break :test_mod test_mod;3280 break :test_mod test_mod;
3282 } else try Package.Module.create(arena, .{3281 } else try Module.create(arena, .{
3283 .paths = .{3282 .paths = .{
3284 .root = try .fromRoot(arena, dirs, .zig_lib, "compiler"),3283 .root = try .fromRoot(arena, dirs, .zig_lib, "compiler"),
3285 .root_src_path = "test_runner.zig",3284 .root_src_path = "test_runner.zig",
...@@ -3973,10 +3972,10 @@ fn createModule(...@@ -3973,10 +3972,10 @@ fn createModule(
3973 io: Io,3972 io: Io,
3974 create_module: *CreateModule,3973 create_module: *CreateModule,
3975 index: usize,3974 index: usize,
3976 parent: ?*Package.Module,3975 parent: ?*Module,
3977 color: std.zig.Color,3976 color: std.zig.Color,
3978 environ_map: *process.Environ.Map,3977 environ_map: *process.Environ.Map,
3979) Allocator.Error!*Package.Module {3978) Allocator.Error!*Module {
3980 const cli_mod = &create_module.modules.values()[index];3979 const cli_mod = &create_module.modules.values()[index];
3981 if (cli_mod.resolved) |m| return m;3980 if (cli_mod.resolved) |m| return m;
39823981
...@@ -4252,7 +4251,7 @@ fn createModule(...@@ -4252,7 +4251,7 @@ fn createModule(
42524251
4253 const root: Compilation.Path = try .fromUnresolved(arena, create_module.dirs, &.{cli_mod.root_path});4252 const root: Compilation.Path = try .fromUnresolved(arena, create_module.dirs, &.{cli_mod.root_path});
42544253
4255 const mod = Package.Module.create(arena, .{4254 const mod = Module.create(arena, .{
4256 .paths = .{4255 .paths = .{
4257 .root = root,4256 .root = root,
4258 .root_src_path = cli_mod.root_src_path,4257 .root_src_path = cli_mod.root_src_path,
...@@ -4919,7 +4918,7 @@ fn jitCmdInner(...@@ -4919,7 +4918,7 @@ fn jitCmdInner(
4919 options: JitCmdOptions,4918 options: JitCmdOptions,
4920) !void {4919) !void {
4921 const target_query: std.Target.Query = .{};4920 const target_query: std.Target.Query = .{};
4922 const resolved_target: Package.Module.ResolvedTarget = .{4921 const resolved_target: Module.ResolvedTarget = .{
4923 .result = std.zig.resolveTargetQueryOrFatal(io, target_query),4922 .result = std.zig.resolveTargetQueryOrFatal(io, target_query),
4924 .is_native_os = true,4923 .is_native_os = true,
4925 .is_native_abi = true,4924 .is_native_abi = true,
...@@ -4959,7 +4958,7 @@ fn jitCmdInner(...@@ -4959,7 +4958,7 @@ fn jitCmdInner(
4959 // We want to release all the locks before executing the child process, so we make a nice4958 // We want to release all the locks before executing the child process, so we make a nice
4960 // big block here to ensure the cleanup gets run when we extract out our argv.4959 // big block here to ensure the cleanup gets run when we extract out our argv.
4961 {4960 {
4962 const main_mod_paths: Package.Module.CreateOptions.Paths = .{4961 const main_mod_paths: Module.CreateOptions.Paths = .{
4963 .root = try .fromRoot(arena, dirs, .zig_lib, "compiler"),4962 .root = try .fromRoot(arena, dirs, .zig_lib, "compiler"),
4964 .root_src_path = options.root_src_path,4963 .root_src_path = options.root_src_path,
4965 };4964 };
...@@ -4974,7 +4973,7 @@ fn jitCmdInner(...@@ -4974,7 +4973,7 @@ fn jitCmdInner(
4974 .is_test = false,4973 .is_test = false,
4975 });4974 });
49764975
4977 const root_mod = try Package.Module.create(arena, .{4976 const root_mod = try Module.create(arena, .{
4978 .paths = main_mod_paths,4977 .paths = main_mod_paths,
4979 .fully_qualified_name = "root",4978 .fully_qualified_name = "root",
4980 .cc_argv = &.{},4979 .cc_argv = &.{},
...@@ -4988,7 +4987,7 @@ fn jitCmdInner(...@@ -4988,7 +4987,7 @@ fn jitCmdInner(
4988 });4987 });
49894988
4990 if (options.depend_on_aro) {4989 if (options.depend_on_aro) {
4991 const aro_mod = try Package.Module.create(arena, .{4990 const aro_mod = try Module.create(arena, .{
4992 .paths = .{4991 .paths = .{
4993 .root = try .fromRoot(arena, dirs, .zig_lib, "compiler/aro"),4992 .root = try .fromRoot(arena, dirs, .zig_lib, "compiler/aro"),
4994 .root_src_path = "aro.zig",4993 .root_src_path = "aro.zig",
...@@ -6023,7 +6022,7 @@ fn handleModArg(...@@ -6023,7 +6022,7 @@ fn handleModArg(
6023 mod_name: []const u8,6022 mod_name: []const u8,
6024 opt_root_src_orig: ?[]const u8,6023 opt_root_src_orig: ?[]const u8,
6025 create_module: *CreateModule,6024 create_module: *CreateModule,
6026 mod_opts: *Package.Module.CreateOptions.Inherited,6025 mod_opts: *Module.CreateOptions.Inherited,
6027 cc_argv: *std.ArrayList([]const u8),6026 cc_argv: *std.ArrayList([]const u8),
6028 target_arch_os_abi: *?[]const u8,6027 target_arch_os_abi: *?[]const u8,
6029 target_mcpu: *?[]const u8,6028 target_mcpu: *?[]const u8,