authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-12-24 19:21:18-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-01 17:51:21-07:00
log4d28db7329c32d7a2b7915d7a5da7f93c4088ccd
treede9341b8223f07d7329d337b622ee2cab2a05c6f
parentedccd68adf58273f44c57ef0d609ec09cc3fb41e

Zcu: mark outdated decl handling as unreachable from only_c builds

This way we don't drag in linker code into only_c builds that doesn't need to be there.

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

src/Module.zig+1-19
...@@ -3167,6 +3167,7 @@ pub fn ensureDeclAnalyzed(mod: *Module, decl_index: Decl.Index) SemaError!void {...@@ -3167,6 +3167,7 @@ pub fn ensureDeclAnalyzed(mod: *Module, decl_index: Decl.Index) SemaError!void {
3167 .complete => return,3167 .complete => return,
31683168
3169 .outdated => blk: {3169 .outdated => blk: {
3170 if (build_options.only_c) unreachable;
3170 // The exports this Decl performs will be re-discovered, so we remove them here3171 // The exports this Decl performs will be re-discovered, so we remove them here
3171 // prior to re-analysis.3172 // prior to re-analysis.
3172 try mod.deleteDeclExports(decl_index);3173 try mod.deleteDeclExports(decl_index);
...@@ -4678,25 +4679,6 @@ pub fn analyzeFnBody(mod: *Module, func_index: InternPool.Index, arena: Allocato...@@ -4678,25 +4679,6 @@ pub fn analyzeFnBody(mod: *Module, func_index: InternPool.Index, arena: Allocato
4678 };4679 };
4679}4680}
46804681
4681fn markOutdatedDecl(mod: *Module, decl_index: Decl.Index) !void {
4682 const decl = mod.declPtr(decl_index);
4683 try mod.comp.work_queue.writeItem(.{ .analyze_decl = decl_index });
4684 if (mod.failed_decls.fetchSwapRemove(decl_index)) |kv| {
4685 kv.value.destroy(mod.gpa);
4686 }
4687 if (mod.cimport_errors.fetchSwapRemove(decl_index)) |kv| {
4688 var errors = kv.value;
4689 errors.deinit(mod.gpa);
4690 }
4691 if (mod.emit_h) |emit_h| {
4692 if (emit_h.failed_decls.fetchSwapRemove(decl_index)) |kv| {
4693 kv.value.destroy(mod.gpa);
4694 }
4695 }
4696 _ = mod.compile_log_decls.swapRemove(decl_index);
4697 decl.analysis = .outdated;
4698}
4699
4700pub fn createNamespace(mod: *Module, initialization: Namespace) !Namespace.Index {4682pub fn createNamespace(mod: *Module, initialization: Namespace) !Namespace.Index {
4701 return mod.intern_pool.createNamespace(mod.gpa, initialization);4683 return mod.intern_pool.createNamespace(mod.gpa, initialization);
4702}4684}