Skip to content

Commit

Permalink
Zcu: fix passing exported decls with compile errors to the backend
Browse files Browse the repository at this point in the history
  • Loading branch information
mlugg authored and jacobly0 committed Jul 9, 2024
1 parent 854e86c commit 47846bc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Zcu/PerThread.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down

0 comments on commit 47846bc

Please sign in to comment.