diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-07-04 10:31:59 +0100 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2024-07-09 12:53:19 -0400 |
| commit | 47846bc17c54d50886b702b5994c00ca8670c82b (patch) | |
| tree | 5391b8a215ca8d2845a4ea6ee5fa5db14d3aee99 /src/Zcu/PerThread.zig | |
| parent | 854e86c5676de82bc46b5c13a0c9c807596e438d (diff) | |
| download | zig-47846bc17c54d50886b702b5994c00ca8670c82b.tar.gz zig-47846bc17c54d50886b702b5994c00ca8670c82b.zip | |
Zcu: fix passing exported decls with compile errors to the backend
Diffstat (limited to 'src/Zcu/PerThread.zig')
| -rw-r--r-- | src/Zcu/PerThread.zig | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig index f8a3104dc0..9903171492 100644 --- a/src/Zcu/PerThread.zig +++ b/src/Zcu/PerThread.zig @@ -2098,6 +2098,25 @@ fn processExportsInner( gop.value_ptr.* = export_idx; } } + + switch (exported) { + .decl_index => |idx| if (failed: { + const decl = zcu.declPtr(idx); + if (decl.analysis != .complete) break :failed true; + // Check if has owned function + if (!decl.owns_tv) break :failed false; + if (decl.typeOf(zcu).zigTypeTag(zcu) != .Fn) break :failed false; + // Check if owned function failed + const a = zcu.funcInfo(decl.val.toIntern()).analysis(&zcu.intern_pool); + break :failed a.state != .success; + }) { + // This `Decl` is failed, so was never sent to codegen. + // TODO: we should probably tell the backend to delete any old exports of this `Decl`? + return; + }, + .value => {}, + } + if (zcu.comp.bin_file) |lf| { try zcu.handleUpdateExports(export_indices, lf.updateExports(pt, exported, export_indices)); } else if (zcu.llvm_object) |llvm_object| { |
