diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-08-11 19:44:29 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-09-24 20:01:19 -0700 |
| commit | 9e979e5a9dbee39d45ac7dc4fbedb63ddcae8e99 (patch) | |
| tree | 39e76a847d026849299c4756a3b124a4e2801199 /src/Sema.zig | |
| parent | ea169e6ccfa0792629bebaa64e9d41fb5dd2a594 (diff) | |
| download | zig-9e979e5a9dbee39d45ac7dc4fbedb63ddcae8e99.tar.gz zig-9e979e5a9dbee39d45ac7dc4fbedb63ddcae8e99.zip | |
Compilation: re-implement cImport
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index d0576de33d..73c5b13c21 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -5713,10 +5713,6 @@ fn zirCImport(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileEr const extra = sema.code.extraData(Zir.Inst.Block, pl_node.payload_index); const body = sema.code.bodySlice(extra.end, extra.data.body_len); - // we check this here to avoid undefined symbols - if (!build_options.have_llvm) - return sema.fail(parent_block, src, "C import unavailable; Zig compiler built without LLVM extensions", .{}); - var c_import_buf = std.array_list.Managed(u8).init(gpa); defer c_import_buf.deinit(); @@ -5741,8 +5737,11 @@ fn zirCImport(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileEr _ = try sema.analyzeInlineBody(&child_block, body, inst); - 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)}); + const prog_node = zcu.cur_sema_prog_node.start("@cImport", 0); + defer prog_node.end(); + + var c_import_res = comp.cImport(c_import_buf.items, parent_block.ownerModule(), prog_node) catch |err| + return sema.fail(&child_block, src, "C import failed: {t}", .{err}); defer c_import_res.deinit(gpa); if (c_import_res.errors.errorMessageCount() != 0) { |
