| ... | @@ -2098,6 +2098,25 @@ fn processExportsInner( | ... | @@ -2098,6 +2098,25 @@ fn processExportsInner( |
| 2098 | gop.value_ptr.* = export_idx; | 2098 | gop.value_ptr.* = export_idx; |
| 2099 | } | 2099 | } |
| 2100 | } | 2100 | } |
| | 2101 | |
| | 2102 | switch (exported) { |
| | 2103 | .decl_index => |idx| if (failed: { |
| | 2104 | const decl = zcu.declPtr(idx); |
| | 2105 | if (decl.analysis != .complete) break :failed true; |
| | 2106 | // Check if has owned function |
| | 2107 | if (!decl.owns_tv) break :failed false; |
| | 2108 | if (decl.typeOf(zcu).zigTypeTag(zcu) != .Fn) break :failed false; |
| | 2109 | // Check if owned function failed |
| | 2110 | const a = zcu.funcInfo(decl.val.toIntern()).analysis(&zcu.intern_pool); |
| | 2111 | break :failed a.state != .success; |
| | 2112 | }) { |
| | 2113 | // This `Decl` is failed, so was never sent to codegen. |
| | 2114 | // TODO: we should probably tell the backend to delete any old exports of this `Decl`? |
| | 2115 | return; |
| | 2116 | }, |
| | 2117 | .value => {}, |
| | 2118 | } |
| | 2119 | |
| 2101 | if (zcu.comp.bin_file) |lf| { | 2120 | if (zcu.comp.bin_file) |lf| { |
| 2102 | try zcu.handleUpdateExports(export_indices, lf.updateExports(pt, exported, export_indices)); | 2121 | try zcu.handleUpdateExports(export_indices, lf.updateExports(pt, exported, export_indices)); |
| 2103 | } else if (zcu.llvm_object) |llvm_object| { | 2122 | } else if (zcu.llvm_object) |llvm_object| { |