aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-12-14 16:41:20 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-01-01 17:51:19 -0700
commitf54471b54c471bb6f8e51a1383be09d01c24d0c3 (patch)
tree63b869ef277027fc0f21e4789b953d9d2e421e68 /src/Sema.zig
parent769dea6e37ffef32f0972a0b958ff2ea38db6854 (diff)
downloadzig-f54471b54c471bb6f8e51a1383be09d01c24d0c3.tar.gz
zig-f54471b54c471bb6f8e51a1383be09d01c24d0c3.zip
compiler: miscellaneous branch progress
implement builtin.zig file population for all modules rather than assuming there is only one global builtin.zig module. move some fields from link.File to Compilation move some fields from Module to Compilation compute debug_format in global Compilation config resolution wire up C compilation to the concept of owner modules make whole cache mode call link.File.createEmpty() instead of link.File.open()
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 910b1cca47..2d46faf435 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -784,6 +784,11 @@ pub const Block = struct {
}
}
+ pub fn ownerModule(block: Block) *Package.Module {
+ const zcu = block.sema.mod;
+ return zcu.namespacePtr(block.namespace).file_scope.mod;
+ }
+
pub fn startAnonDecl(block: *Block) !WipAnonDecl {
return WipAnonDecl{
.block = block,
@@ -5733,7 +5738,7 @@ fn zirCImport(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileEr
// Ignore the result, all the relevant operations have written to c_import_buf already.
_ = try sema.analyzeBodyBreak(&child_block, body);
- var c_import_res = comp.cImport(c_import_buf.items) catch |err|
+ var c_import_res = comp.cImport(c_import_buf.items, parent_block.ownerModule()) catch |err|
return sema.fail(&child_block, src, "C import failed: {s}", .{@errorName(err)});
defer c_import_res.deinit(gpa);