stage2: fixes to extern variables

* Relax compile error for "unable to export type foo" to allow
   integers, structs, arrays, and floats. This will need to be further
   improved to do the same checks as we do for C ABI struct field types.
 * LLVM backend: fix extern variables
 * LLVM backend: implement AIR instruction `wrap_err_union_payload`
This commit is contained in:
Andrew Kelley committed 2021-10-16 12:26:06 -07:00
1 parent 82ec56e47e
commit 4d6d6977b0
3 files changed
+63 -22

No files matched your search

+9
View File
@@ -754,6 +754,15 @@ pub const Decl = struct {
fn removeDependency(decl: *Decl, other: *Decl) void {
assert(decl.dependencies.swapRemove(other));
}
pub fn isExtern(decl: Decl) bool {
assert(decl.has_tv);
return switch (decl.val.tag()) {
.extern_fn => true,
.variable => decl.val.castTag(.variable).?.data.init.tag() == .unreachable_value,
else => false,
};
}
};
/// This state is attached to every Decl when Module emit_h is non-null.